[vispy] 02/04: Imported Upstream version 0.4.0
Frédéric-Emmanuel Picca
picca at moszumanska.debian.org
Tue Aug 18 16:59:55 UTC 2015
This is an automated email from the git hooks/post-receive script.
picca pushed a commit to branch master
in repository vispy.
commit 88069c3186df711cb8784f40349645f6663d4750
Author: Picca Frédéric-Emmanuel <picca at debian.org>
Date: Tue Aug 18 16:26:03 2015 +0200
Imported Upstream version 0.4.0
---
.coveragerc | 16 -
.gitignore | 16 -
.travis.yml | 199 --
CONTRIBUTORS.txt | 55 -
LICENSE.txt | 49 -
Makefile | 90 -
PKG-INFO | 40 +
appveyor.yml | 36 -
codegen/annotations.py | 661 -------
codegen/createglapi.py | 791 --------
codegen/get-deprecated.py | 69 -
codegen/headerparser.py | 370 ----
codegen/headers/egl.h | 329 ----
codegen/headers/gl2.h | 620 ------
codegen/headers/gl2ext.h | 2051 --------------------
codegen/headers/webgl.idl | 743 -------
doc/.requirements | 3 -
doc/Makefile | 160 --
doc/_templates/localtoc.html | 10 -
doc/_templates/navbar.html | 4 -
doc/_templates/navigation.html | 12 -
doc/_templates/versions.html | 9 -
doc/app.rst | 32 -
doc/color.rst | 6 -
doc/conf.py | 284 ---
doc/ext/docscrape.py | 515 -----
doc/ext/docscrape_sphinx.py | 238 ---
doc/ext/examplesgenerator.py | 148 --
doc/ext/glapigenerator.py | 62 -
doc/ext/gloooverviewgenerator.py | 95 -
doc/ext/numpydoc.py | 178 --
doc/ext/scriptnamemangler.py | 31 -
doc/ext/vispy_ext.py | 26 -
doc/geometry.rst | 6 -
doc/gloo.rst | 84 -
doc/index.rst | 97 -
doc/io.rst | 6 -
doc/make.bat | 190 --
doc/mpl_plot.rst | 6 -
doc/plot.rst | 6 -
doc/releasenotes.rst | 44 -
doc/scene.rst | 53 -
doc/themes/scikit-image/layout.html | 113 --
doc/themes/scikit-image/search.html | 59 -
.../static/css/bootstrap-responsive.min.css | 9 -
.../scikit-image/static/css/bootstrap.min.css | 9 -
doc/themes/scikit-image/static/css/custom.css | 239 ---
doc/themes/scikit-image/static/img/favicon.ico | Bin 10134 -> 0 bytes
.../static/img/glyphicons-halflings-white.png | Bin 8777 -> 0 bytes
.../static/img/glyphicons-halflings.png | Bin 12799 -> 0 bytes
doc/themes/scikit-image/static/js/bootstrap.min.js | 6 -
doc/themes/scikit-image/theme.conf | 4 -
doc/user_guide.md | 329 ----
doc/util.rst | 60 -
doc/vispy.rst | 6 -
examples/basics/gloo/animate_images.py | 114 --
examples/basics/gloo/animate_images_slice.py | 143 --
examples/basics/gloo/animate_shape.py | 110 --
examples/basics/gloo/display_lines.py | 129 --
examples/basics/gloo/display_points.py | 95 -
examples/basics/gloo/display_shape.py | 62 -
examples/basics/gloo/gpuimage.py | 114 --
examples/basics/gloo/hello_fbo.py | 121 --
examples/basics/gloo/multi_texture.py | 88 -
examples/basics/gloo/post_processing.py | 153 --
examples/basics/gloo/rotate_cube.py | 169 --
examples/basics/gloo/start.py | 20 -
examples/basics/gloo/start_shaders.py | 50 -
examples/basics/plotting/export.py | 31 -
examples/basics/plotting/mpl_plot.py | 56 -
examples/basics/plotting/scatter_histogram.py | 25 -
examples/basics/plotting/spectrogram.py | 26 -
examples/basics/plotting/volume.py | 31 -
examples/basics/scene/background_borders.py | 22 -
examples/basics/scene/colored_line.py | 49 -
examples/basics/scene/console.py | 47 -
examples/basics/scene/cube.py | 23 -
examples/basics/scene/flipped_axis.py | 87 -
examples/basics/scene/grid.py | 82 -
examples/basics/scene/grid_large.py | 41 -
examples/basics/scene/image.py | 31 -
examples/basics/scene/isocurve.py | 45 -
examples/basics/scene/isocurve_for_trisurface.py | 46 -
examples/basics/scene/isosurface.py | 56 -
examples/basics/scene/line.py | 49 -
examples/basics/scene/line_update.py | 41 -
examples/basics/scene/modular_shaders/editor.py | 196 --
examples/basics/scene/modular_shaders/sandbox.py | 618 ------
examples/basics/scene/nested_viewbox.py | 151 --
examples/basics/scene/one_cam_two_scenes.py | 51 -
examples/basics/scene/one_scene_four_cams.py | 70 -
examples/basics/scene/sensitivity.py | 43 -
examples/basics/scene/shared_context.py | 45 -
examples/basics/scene/stereo.py | 57 -
examples/basics/scene/surface_plot.py | 38 -
examples/basics/scene/text.py | 49 -
examples/basics/scene/viewbox.py | 89 -
examples/basics/scene/volume.py | 133 --
examples/basics/visuals/arcball.py | 76 -
examples/basics/visuals/cube.py | 54 -
examples/basics/visuals/custom_visual.py | 152 --
examples/basics/visuals/dynamic_polygon.py | 117 --
examples/basics/visuals/image_transforms.py | 123 --
examples/basics/visuals/image_visual.py | 42 -
examples/basics/visuals/line.py | 108 --
examples/basics/visuals/line_plot.py | 43 -
examples/basics/visuals/line_transform.py | 90 -
examples/basics/visuals/markers.py | 70 -
examples/basics/visuals/mesh.py | 93 -
examples/basics/visuals/polygon_visual.py | 97 -
examples/basics/visuals/rescalingmarkers.py | 62 -
examples/basics/visuals/text_visual.py | 42 -
examples/basics/visuals/tube.py | 70 -
examples/basics/visuals/visual_filters.py | 108 --
examples/benchmark/scene_test_1.py | 355 ----
examples/benchmark/scene_test_2.py | 193 --
examples/benchmark/simple_glut.py | 47 -
examples/benchmark/simple_vispy.py | 27 -
examples/collections/choropleth.py | 84 -
examples/collections/path_collection.py | 49 -
examples/collections/point_collection.py | 35 -
examples/collections/polygon_collection.py | 54 -
examples/collections/segment_collection.py | 40 -
examples/collections/tiger.py | 75 -
examples/collections/triangle_collection.py | 69 -
examples/demo/gloo/atom.py | 171 --
examples/demo/gloo/boids.py | 192 --
examples/demo/gloo/brain.py | 155 --
examples/demo/gloo/camera.py | 78 -
examples/demo/gloo/cloud.py | 298 ---
examples/demo/gloo/donut.py | 194 --
examples/demo/gloo/fireworks.py | 148 --
examples/demo/gloo/galaxy.py | 195 --
examples/demo/gloo/galaxy/galaxy.py | 205 --
examples/demo/gloo/galaxy/galaxy_simulation.py | 235 ---
examples/demo/gloo/galaxy/galaxy_specrend.py | 422 ----
examples/demo/gloo/game_of_life.py | 180 --
examples/demo/gloo/glsl_sandbox_cube.py | 180 --
examples/demo/gloo/graph.py | 190 --
examples/demo/gloo/grayscott.py | 208 --
examples/demo/gloo/high_frequency.py | 119 --
examples/demo/gloo/imshow.py | 128 --
examples/demo/gloo/imshow_cuts.py | 191 --
examples/demo/gloo/jfa/fragment_display.glsl | 23 -
examples/demo/gloo/jfa/fragment_flood.glsl | 159 --
examples/demo/gloo/jfa/fragment_seed.glsl | 21 -
examples/demo/gloo/jfa/jfa_translation.py | 259 ---
examples/demo/gloo/jfa/jfa_vispy.py | 117 --
examples/demo/gloo/jfa/vertex.glsl | 24 -
examples/demo/gloo/jfa/vertex_vispy.glsl | 26 -
examples/demo/gloo/mandelbrot.py | 181 --
examples/demo/gloo/mandelbrot_double.py | 302 ---
examples/demo/gloo/molecular_viewer.py | 195 --
examples/demo/gloo/ndscatter.py | 142 --
examples/demo/gloo/offscreen.py | 146 --
examples/demo/gloo/primitive_mesh_viewer_qt.py | 378 ----
examples/demo/gloo/quiver.py | 292 ---
examples/demo/gloo/rain.py | 147 --
examples/demo/gloo/raytracing.py | 258 ---
examples/demo/gloo/realtime_signals.py | 165 --
examples/demo/gloo/shadertoy.py | 441 -----
examples/demo/gloo/signals.py | 131 --
examples/demo/gloo/spacy.py | 174 --
examples/demo/gloo/terrain.py | 212 --
examples/demo/gloo/unstructured_2d.py | 216 ---
examples/demo/gloo/voronoi.py | 119 --
examples/demo/scene/isocurve_for_trisurface_qt.py | 129 --
examples/demo/scene/magnify.py | 97 -
examples/ipynb/colormaps.ipynb | 163 --
examples/ipynb/webgl_example_1.ipynb | 211 --
examples/ipynb/webgl_example_2.ipynb | 270 ---
examples/tutorial/app/app_events.py | 61 -
examples/tutorial/app/fps.py | 39 -
examples/tutorial/app/interactive.py | 54 -
examples/tutorial/app/shared_context.py | 75 -
examples/tutorial/app/simple.py | 35 -
examples/tutorial/app/simple_wx.py | 56 -
examples/tutorial/gl/cube.py | 233 ---
examples/tutorial/gl/fireworks.py | 159 --
examples/tutorial/gl/quad.py | 116 --
examples/tutorial/gloo/colored_cube.py | 95 -
examples/tutorial/gloo/colored_quad.py | 56 -
examples/tutorial/gloo/lighted_cube.py | 157 --
examples/tutorial/gloo/outlined_cube.py | 114 --
examples/tutorial/gloo/rotating_quad.py | 72 -
examples/tutorial/gloo/texture_precision.py | 143 --
examples/tutorial/gloo/textured_cube.py | 107 -
examples/tutorial/gloo/textured_quad.py | 64 -
examples/tutorial/visuals/T01_basic_visual.py | 167 --
examples/tutorial/visuals/T02_measurements.py | 227 ---
examples/tutorial/visuals/T03_antialiasing.py | 216 ---
examples/tutorial/visuals/T04_fragment_programs.py | 81 -
examples/tutorial/visuals/T05_viewer_location.py | 97 -
make/__init__.py | 6 -
make/__main__.py | 13 -
make/install_python.ps1 | 125 --
make/make.py | 543 ------
setup.cfg | 5 +
stdeb.cfg | 7 -
vispy.egg-info/PKG-INFO | 40 +
vispy.egg-info/SOURCES.txt | 447 +++++
vispy.egg-info/dependency_links.txt | 1 +
vispy.egg-info/not-zip-safe | 1 +
vispy.egg-info/requires.txt | 1 +
vispy.egg-info/top_level.txt | 1 +
vispy.proxy.py | 52 -
vispy/scene/cameras/tests/test_perspective.py | 57 -
vispy/visuals/tests/test_collections.py | 16 -
vispy/visuals/tests/test_ellipse.py | 123 --
vispy/visuals/tests/test_histogram.py | 25 -
vispy/visuals/tests/test_image.py | 25 -
vispy/visuals/tests/test_markers.py | 31 -
vispy/visuals/tests/test_polygon.py | 105 -
vispy/visuals/tests/test_rectangle.py | 138 --
vispy/visuals/tests/test_regular_polygon.py | 106 -
vispy/visuals/tests/test_sdf.py | 43 -
vispy/visuals/tests/test_spectrogram.py | 30 -
vispy/visuals/tests/test_text.py | 21 -
vispy/visuals/tests/test_volume.py | 61 -
vispy/visuals/transforms/tests/test_transforms.py | 246 ---
220 files changed, 536 insertions(+), 27989 deletions(-)
diff --git a/.coveragerc b/.coveragerc
deleted file mode 100644
index 30dbd50..0000000
--- a/.coveragerc
+++ /dev/null
@@ -1,16 +0,0 @@
-[run]
-branch = True
-source = vispy
-#include = */vispy/*
-# Omit fonts/_quartz.py and _win32 for platform specificity
-omit =
- */vispy/app/backends/_egl.py
- */vispy/gloo/gl/es2.py
- */vispy/gloo/gl/_es2.py
- */vispy/testing/*
- */vispy/ext/*
- */vispy/geometry/_triangulation_debugger.py
- */vispy/util/fonts/_quartz.py
- */vispy/util/fonts/_win32.py
- */vispy/util/dpi/_quartz.py
- */vispy/util/dpi/_win32.py
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 8210326..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-*.c
-*.so
-*.pyc
-*.pyo
-*.DS_Store
-doc/_build
-/_website
-/_gh-pages
-/_images
-/_demo-data
-build
-dist
-MANIFEST
-.coverage*
-htmlcov
-vispy.egg-info
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 55e91f4..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,199 +0,0 @@
-language: python
-
-# Here we use anaconda for 2.6 and 3.4, since it provides the simplest
-# interface for running different versions of Python. We could also use
-# it for 2.7, but the Ubuntu system has installable 2.7 Qt4-GL, which
-# allows for more complete testing.
-
-# Size testing can be skipped by adding "[size skip]" within a commit message.
-
-virtualenv:
- system_site_packages: true
-
-
-env:
- # Enable python 2 and python 3 builds
- # Note that the 2.6 build doesn't get flake8, and runs old versions of
- # Pyglet and GLFW to make sure we deal with those correctly
- - PYTHON=2.6 DEPS=full TEST=standard # functionality
- - PYTHON=2.7 DEPS=full TEST=standard
- - PYTHON=2.7 DEPS=minimal TEST=standard
- - PYTHON=3.4 DEPS=full TEST=standard
-
- - PYTHON=2.7 DEPS=full TEST=examples # test examples
- - PYTHON=3.4 DEPS=full TEST=examples
-
- - PYTHON=3.4 DEPS=minimal TEST=extra # test file sizes, style, line endings
-
-
-before_install:
- - REDIRECT_TO=/dev/stdout # change to /dev/null to silence Travis
- # install a newer cmake since at this time Travis only has version 2.8.7
- - if [ "${PYTHON}" != "2.6" ] && [ "${DEPS}" == "full" ]; then
- travis_retry sudo add-apt-repository -y ppa:kalakris/cmake;
- travis_retry sudo apt-get -y update -qq;
- travis_retry sudo apt-get -qq -y install cmake;
- fi;
- - if [ "${PYTHON}" != "2.7" ]; then
- wget -q http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
- chmod +x miniconda.sh;
- ./miniconda.sh -b -p ~/anaconda &> ${REDIRECT_TO};
- export PATH=~/anaconda/bin:$PATH;
- conda update --yes --quiet conda &> ${REDIRECT_TO};
- travis_retry sudo apt-get -qq -y install libgl1-mesa-dri;
- fi;
-
- - SRC_DIR=$(pwd)
- # file size checks
- - if [ "${TEST}" == "extra" ]; then
- if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
- GIT_TARGET_EXTRA="+refs/heads/${TRAVIS_BRANCH}";
- GIT_SOURCE_EXTRA="+refs/pull/${TRAVIS_PULL_REQUEST}/merge";
- else
- GIT_TARGET_EXTRA="";
- GIT_SOURCE_EXTRA="";
- fi;
- cd ~;
- mkdir target-size-clone && cd target-size-clone;
- git init &> ${REDIRECT_TO} && git remote add -t ${TRAVIS_BRANCH} origin git://github.com/${TRAVIS_REPO_SLUG}.git &>${REDIRECT_TO};
- git fetch origin ${GIT_TARGET_EXTRA} &> ${REDIRECT_TO} && git checkout -qf FETCH_HEAD &> ${REDIRECT_TO};
- git tag travis-merge-target &> ${REDIRECT_TO};
- git gc --aggressive &> ${REDIRECT_TO};
- TARGET_SIZE=`du -s . | sed -e "s/\t.*//"`;
- git pull origin ${GIT_SOURCE_EXTRA} &> ${REDIRECT_TO};
- git gc --aggressive &> ${REDIRECT_TO};
- MERGE_SIZE=`du -s . | sed -e "s/\t.*//"`;
- if [ "${MERGE_SIZE}" != "${TARGET_SIZE}" ]; then
- SIZE_DIFF=`expr \( ${MERGE_SIZE} - ${TARGET_SIZE} \)`;
- else
- SIZE_DIFF=0;
- fi;
- fi;
-
-
-install:
- # Install numpy, flake
- - if [ "${PYTHON}" != "2.7" ]; then
- conda create -n testenv --yes --quiet pip python=$PYTHON > ${REDIRECT_TO};
- source activate testenv > ${REDIRECT_TO};
- conda install --yes --quiet numpy nose pytest > ${REDIRECT_TO};
- else
- travis_retry sudo apt-get -qq -y install python-numpy python-setuptools > ${REDIRECT_TO};
- pip install -q pytest > ${REDIRECT_TO};
- fi;
- - pip install -q coveralls pytest-cov
- # Dont install flake8 on 2.6 to make sure tests still run without it
- - if [ "${PYTHON}" != "2.6" ]; then
- pip install -q flake8;
- else
- pip install -q unittest2;
- fi
-
- # Install PyOpenGL
- - if [ "${DEPS}" == "full" ]; then
- travis_retry sudo apt-get -qq -y install freeglut3 > ${REDIRECT_TO};
- if [ "${PYTHON}" == "2.7" ]; then
- echo "Using OpenGL stable version (repos)";
- travis_retry sudo apt-get -qq -y install python-opengl > ${REDIRECT_TO};
- else
- echo "Using OpenGL stable version (pip)";
- pip install -q PyOpenGL;
- fi;
- fi;
-
- # Use Pyglet alpha to get Py3.4 support
- # Also install PyQt4, imaging (PIL or pillow), scipy, mpl, egl
- # Test old (insufficient) version of Pyglet on 2.6
- # On conda, can't install pyside-pyzo b/c it conflicts with pyqt4,
- # which is required by matplotlib :(
- # No wx on py3k, wxpython doesn't work there (!)
- - if [ "${DEPS}" == "full" ]; then
- if [ "${PYTHON}" == "2.6" ]; then
- pip install -q pyglet;
- conda install --yes --quiet wxpython > ${REDIRECT_TO};
- else
- pip install -q https://bitbucket.org/pyglet/pyglet/get/tip.zip;
- fi;
- if [ "${PYTHON}" == "3.4" ]; then
- conda install --yes --quiet pillow scipy matplotlib > ${REDIRECT_TO};
- fi;
- if [ "${PYTHON}" == "2.7" ]; then
- travis_retry sudo apt-get -qq -y install python-qt4-gl python-imaging python-scipy python-matplotlib python-wxgtk2.8 > ${REDIRECT_TO};
- fi;
- travis_retry sudo apt-get -qq -y install libegl1-mesa;
- fi;
-
- # Install vispy
- - cd ${SRC_DIR}
- - python setup.py install > ${REDIRECT_TO}
- - cd ~
-
- # GLFW: version 2 shouldn't work (so let's try on Py2.6), version 3 will
- # We can't use most recent builds because our CMake is too old :(
- - if [ "${PYTHON}" == "2.6" ] && [ "${DEPS}" == "full" ]; then
- travis_retry sudo apt-get -qq install libglfw2 > ${REDIRECT_TO};
- fi
- - if [ "${PYTHON}" != "2.6" ] && [ "${DEPS}" == "full" ]; then
- travis_retry sudo apt-get -qq install xorg-dev libglu1-mesa-dev > ${REDIRECT_TO};
- git clone git://github.com/glfw/glfw.git &> ${REDIRECT_TO};
- cd glfw;
- git checkout 5b6e671;
- cmake -DBUILD_SHARED_LIBS=true -DGLFW_BUILD_EXAMPLES=false -DGLFW_BUILD_TESTS=false -DGLFW_BUILD_DOCS=false . > ${REDIRECT_TO};
- sudo make install > ${REDIRECT_TO};
- fi
-
- # Install SDL2 (on 2.6, let's only install sdl2-python to test handling)
- - if [ "${DEPS}" == "full" ]; then
- if [ "${PYTHON}" != "2.6" ]; then
- cd ~;
- travis_retry sudo apt-get -qq -y install mercurial libdbus-1-dev libgl1-mesa-dev libglu1-mesa-dev libpulse-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev libasound2-dev libts-dev libudev-dev > ${REDIRECT_TO};
- wget -q http://www.libsdl.org/release/SDL2-2.0.3.tar.gz;
- tar xzf SDL2-2.0.3.tar.gz &> ${REDIRECT_TO};
- cd SDL2-2.0.3;
- mkdir build;
- cd build;
- ../configure --disable-audio --disable-render --disable-joystick --disable-haptic --disable-power --disable-cpuinfo &> ${REDIRECT_TO};
- make -j 2 &> ${REDIRECT_TO};
- sudo make install &> ${REDIRECT_TO};
- fi;
- pip install -q PySDL2;
- fi;
-
- # after manual builds we need to update .so search
- - sudo ldconfig
-
-
-before_script:
- # We need to create a (fake) display on Travis, let's use a funny resolution
- - export DISPLAY=:99.0
- - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render
-
-
-script:
- - cd ${SRC_DIR}
- - if [ "${TEST}" == "standard" ]; then
- make unit;
- fi;
- - if [ "${TEST}" == "examples" ] || [ "${DEPS}" == "minimal" ]; then
- make examples;
- fi;
- - if [ "${TEST}" == "extra" ]; then
- make extra;
- fi;
- # Each line must be run in a separate line to ensure exit code accuracy
- - if [ "${TEST}" == "extra" ]; then
- echo "Size difference ${SIZE_DIFF} kB";
- if git log --format=%B -n 2 | grep -q "\[size skip\]"; then
- echo "Skipping size test";
- else
- test ${SIZE_DIFF} -lt 100;
- fi;
- fi;
-
-
-after_success:
- # Need to run from source dir to execute appropriate "git" commands
- - if [ "${TEST}" == "standard" ]; then
- coverage combine;
- coveralls;
- fi;
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
deleted file mode 100644
index 4239c85..0000000
--- a/CONTRIBUTORS.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-Core team
----------
-
-- Luke Campagnola
-
-- Almar Klein
-
-- Nicolas Rougier
-
-- Cyrille Rossant
-
-- Eric Larson
-
-
-Contributors
-------------
-
-- Jerome Kieffer
- keep it compatible with python 2.6 #68
-
-- M S Suraj
- Reactive visuals (#353, #368)
- Visuals and geometry (#275)
- Terrain generation using scipy delaunay triangulation (#191
- Canvas object provides fps (#109)
-
-- Mustafa Furkan Kaptan
- Fixes in read_pixels (#301)
- Static IPython notebook backend (#333)
- VNC IPython notebook backend (#356)
-
-- Matthieu Dartiailh
- Add support for parent keyword at Canvas init (#294)
- Implement the sizeHint method of CanvasBacjkend in Qt (#289)
-
-- Irwin Zaid
- Support for 3D textures (#292)
-
-- gouarin
- fix bug in game-of-life.py (#266)
-
-- Per Rosengren
- unstructured_2d demo (203, #276)
-- Matthias Vogelgesang
- Simplify setup py (#70)
-
-- John David Reaver
- Mandelbrot set demo (#239)
- Several fixes (#231, #266)
-
-- joe311
- Tailed arrow marker (#60)
-
-- Tom Pohl
- added required constants and input keys to handle 3d textures (#27)
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index 22c7511..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-Vispy licensing terms
----------------------
-
-Vispy is licensed under the terms of the (new) BSD license:
-
-Copyright (c) 2013, Vispy Development Team
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-* Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-* Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-* Neither the name of Vispy Development Team nor the names of its
- contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-Exceptions
-----------
-
-The examples code in the examples directory can be considered public
-domain, unless otherwise indicated in the corresponding source file.
-
-
-The Vispy Development Team
---------------------------
-
-The Vispy Development Team is the set of all contributors to the Vispy
-project. The core team that coordinates development consists of:
-
- * Luke Campagnola
- * Nicolas Rougier
- * Cyrille Rossant
- * Almar Klein
-
\ No newline at end of file
diff --git a/Makefile b/Makefile
deleted file mode 100755
index a1fa756..0000000
--- a/Makefile
+++ /dev/null
@@ -1,90 +0,0 @@
-# simple makefile to simplify repetetive build env management tasks under posix
-
-CTAGS ?= ctags
-
-all: clean inplace test
-
-clean-pyc:
- @find . -name "*.pyc" | xargs rm -f
-
-clean-so:
- @find . -name "*.so" | xargs rm -f
- @find . -name "*.pyd" | xargs rm -f
-
-clean-build:
- @rm -rf build
-
-clean-ctags:
- @rm -f tags
-
-clean-cache:
- @find . -name "__pycache__" | xargs rm -rf
-
-clean: clean-build clean-pyc clean-so clean-ctags clean-cache
- @echo "Cleaning build, pyc, so, ctags, and cache"
-
-clean-test: clean-build clean-pyc clean-ctags clean-cache
- @echo "Cleaning build, pyc, ctags, and cache"
-
-in: inplace # just a shortcut
-inplace:
- python setup.py build_ext -i
-
-# Test conditions, don't "clean-so" or builds won't work!
-
-unit: clean-test
- python make test unit
-
-examples: clean-test
- python make test examples
-
-coverage_html:
- python make coverage_html
-
-gallery:
- python make images gallery
-
-test: clean-test
- python make test full
-
-test3: clean-test
- python3 make test full
-
-flake: clean-test
- python make test flake
-
-flake3: clean-test
- python3 make test flake
-
-lineendings: clean-test
- python make test lineendings
-
-extra: clean-test
- python make test extra
-
-nobackend : clean-test
- python make test nobackend
-
-pyqt4: clean-test
- python make test pyqt4
-
-pyside: clean-test
- python make test pyside
-
-pyglet: clean-test
- python make test pyglet
-
-glfw: clean-test
- python make test glfw
-
-sdl2: clean-test
- python make test sdl2
-
-wx: clean-test
- python make test wx
-
-egl: clean-test
- python make test egl
-
-ipynb_vnc: clean-test
- python make test ipynb_vnc
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..ec56206
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,40 @@
+Metadata-Version: 1.1
+Name: vispy
+Version: 0.4.0
+Summary: Interactive visualization in Python
+Home-page: http://vispy.org
+Author: Vispy contributors
+Author-email: vispy at googlegroups.com
+License: (new) BSD
+Download-URL: https://pypi.python.org/pypi/vispy
+Description:
+
+ =====
+ Vispy
+ =====
+
+ Vispy is a **high-performance interactive 2D/3D data visualization
+ library**. Vispy leverages the computational power of modern **Graphics
+ Processing Units (GPUs)** through the **OpenGL** library to display very
+ large datasets.
+
+ For more information, see http://vispy.org.
+
+
+Keywords: visualization OpenGl ES medical imaging 3D plotting numpy bigdata
+Platform: any
+Classifier: Development Status :: 3 - Alpha
+Classifier: Intended Audience :: Science/Research
+Classifier: Intended Audience :: Education
+Classifier: Intended Audience :: Developers
+Classifier: Topic :: Scientific/Engineering :: Visualization
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Provides: vispy
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 1cfa44d..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-# CI on Windows via appveyor
-# This file was based on Olivier Grisel's python-appveyor-demo
-
-environment:
-
- matrix:
- - PYTHON: "C:\\Python34-conda64"
- PYTHON_VERSION: "3.4"
- PYTHON_ARCH: "64"
-
-install:
- # Install miniconda Python
- - "powershell ./make/install_python.ps1"
-
- # Prepend newly installed Python to the PATH of this build (this cannot be
- # done from inside the powershell script as it would require to restart
- # the parent CMD process).
- - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
-
- # Check that we have the expected version and architecture for Python
- - "python --version"
- - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
- # Skip using MESA for now since AppVeyor is unreliable with it
- # "SET VISPY_GL_LIB=%CD%\\opengl32.dll"
-
- # Install the dependencies of the project.
- # "conda install --yes --quiet numpy scipy matplotlib setuptools flake8 pyqt nose pytest coverage"
- - "conda install --yes --quiet numpy scipy matplotlib setuptools nose pytest coverage"
- - "pip install -q pytest-cov"
- - "python setup.py develop"
-
-build: false # Not a C# project, build stuff at the test step instead.
-
-test_script:
- # Run the project tests
- - "python make test nobackend"
diff --git a/codegen/annotations.py b/codegen/annotations.py
deleted file mode 100644
index ec57b07..0000000
--- a/codegen/annotations.py
+++ /dev/null
@@ -1,661 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2013, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-This module contains manual annotations for the gl backends. Together
-with the header files, we can generatre the full ES 2.0 API.
-
-Every function-annotations consists of sections that apply to one or
-more backends. If no backends are specified in the first section, it
-applies to all backends.
-"""
-
-import ctypes
-
-
-## bind / gen / delete stuff
-
-def deleteBuffer(buffer):
- # --- gl es
- n = 1
- buffers = (ctypes.c_uint*n)(buffer)
- ()
- # --- pyopengl
- GL.glDeleteBuffers(1, [buffer])
-
-def deleteFramebuffer(framebuffer):
- # --- gl es
- n = 1
- framebuffers = (ctypes.c_uint*n)(framebuffer)
- ()
- # --- pyopengl
- FBO.glDeleteFramebuffers(1, [framebuffer])
-
-def deleteRenderbuffer(renderbuffer):
- # --- gl es
- n = 1
- renderbuffers = (ctypes.c_uint*n)(renderbuffer)
- ()
- # --- pyopengl
- FBO.glDeleteRenderbuffers(1, [renderbuffer])
-
-def deleteTexture(texture):
- # --- gl es
- n = 1
- textures = (ctypes.c_uint*n)(texture)
- ()
- # --- pyopengl
- GL.glDeleteTextures([texture])
-
-
-def createBuffer():
- # --- gl es
- n = 1
- buffers = (ctypes.c_uint*n)()
- ()
- return buffers[0]
- # --- pyopengl
- return GL.glGenBuffers(1)
- # --- mock
- return 1
-
-def createFramebuffer():
- # --- gl es
- n = 1
- framebuffers = (ctypes.c_uint*n)()
- ()
- return framebuffers[0]
- # --- pyopengl
- return FBO.glGenFramebuffers(1)
- # --- mock
- return 1
-
-def createRenderbuffer():
- # --- gl es
- n = 1
- renderbuffers = (ctypes.c_uint*n)()
- ()
- return renderbuffers[0]
- # --- pyopengl
- return FBO.glGenRenderbuffers(1)
- # --- mock
- return 1
-
-def createTexture():
- # --- gl es
- n = 1
- textures = (ctypes.c_uint*n)()
- ()
- return textures[0]
- # --- pyopengl
- return GL.glGenTextures(1)
- # --- mock
- return 1
-
-
-## Image stuff
-
-def texImage2D(target, level, internalformat, format, type, pixels):
- border = 0
- # --- gl es
- if isinstance(pixels, (tuple, list)):
- height, width = pixels
- pixels = ctypes.c_void_p(0)
- pixels = None
- else:
- if not pixels.flags['C_CONTIGUOUS']:
- pixels = pixels.copy('C')
- pixels_ = pixels
- pixels = pixels_.ctypes.data
- height, width = pixels_.shape[:2]
- ()
- # --- pyopengl
- if isinstance(pixels, (tuple, list)):
- height, width = pixels
- pixels = None
- else:
- height, width = pixels.shape[:2]
- GL.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels)
-
-
-
-def texSubImage2D(target, level, xoffset, yoffset, format, type, pixels):
- # --- gl es
- if not pixels.flags['C_CONTIGUOUS']:
- pixels = pixels.copy('C')
- pixels_ = pixels
- pixels = pixels_.ctypes.data
- height, width = pixels_.shape[:2]
- ()
- # --- pyopengl
- height, width = pixels.shape[:2]
- GL.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels)
-
-
-def readPixels(x, y, width, height, format, type):
- # --- gl es mock
- # GL_ALPHA, GL_RGB, GL_RGBA
- t = {6406:1, 6407:3, 6408:4}[format]
- # GL_UNSIGNED_BYTE, GL_FLOAT
- nb = {5121:1, 5126:4}[type]
- size = int(width*height*t*nb)
- # --- gl es
- pixels = ctypes.create_string_buffer(size)
- ()
- return pixels[:]
- # --- mock
- return size * b'\x00'
-
-
-def compressedTexImage2D(target, level, internalformat, width, height, border=0, data=None):
- # border = 0 # set in args
- # --- gl es
- if not data.flags['C_CONTIGUOUS']:
- data = data.copy('C')
- data_ = data
- size = data_.size
- data = data_.ctypes.data
- ()
- # --- pyopengl
- size = data.size
- GL.glCompressedTexImage2D(target, level, internalformat, width, height, border, size, data)
-
-
-def compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, data):
- # --- gl es
- if not data.flags['C_CONTIGUOUS']:
- data = data.copy('C')
- data_ = data
- size = data_.size
- data = data_.ctypes.data
- ()
- # --- pyopengl
- size = data.size
- GL.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, size, data)
-
-
-## Buffer data
-
-
-def bufferData(target, data, usage):
- """ Data can be numpy array or the size of data to allocate.
- """
- # --- gl es
- if isinstance(data, int):
- size = data
- data = ctypes.c_voidp(0)
- else:
- if not data.flags['C_CONTIGUOUS'] or not data.flags['ALIGNED']:
- data = data.copy('C')
- data_ = data
- size = data_.nbytes
- data = data_.ctypes.data
- ()
- # --- pyopengl
- if isinstance(data, int):
- size = data
- data = None
- else:
- size = data.nbytes
- GL.glBufferData(target, size, data, usage)
-
-
-def bufferSubData(target, offset, data):
- # --- gl es
- if not data.flags['C_CONTIGUOUS']:
- data = data.copy('C')
- data_ = data
- size = data_.nbytes
- data = data_.ctypes.data
- ()
- # --- pyopengl
- size = data.nbytes
- GL.glBufferSubData(target, offset, size, data)
-
-
-def drawElements(mode, count, type, offset):
- # --- gl es
- if offset is None:
- offset = ctypes.c_void_p(0)
- elif isinstance(offset, ctypes.c_void_p):
- pass
- elif isinstance(offset, (int, ctypes.c_int)):
- offset = ctypes.c_void_p(int(offset))
- else:
- if not offset.flags['C_CONTIGUOUS']:
- offset = offset.copy('C')
- offset_ = offset
- offset = offset.ctypes.data
- indices = offset
- ()
- # --- pyopengl
- if offset is None:
- offset = ctypes.c_void_p(0)
- elif isinstance(offset, (int, ctypes.c_int)):
- offset = ctypes.c_void_p(int(offset))
- ()
-
-
-def vertexAttribPointer(indx, size, type, normalized, stride, offset):
- # --- gl es
- if offset is None:
- offset = ctypes.c_void_p(0)
- elif isinstance(offset, ctypes.c_void_p):
- pass
- elif isinstance(offset, (int, ctypes.c_int)):
- offset = ctypes.c_void_p(int(offset))
- else:
- if not offset.flags['C_CONTIGUOUS']:
- offset = offset.copy('C')
- offset_ = offset
- offset = offset.ctypes.data
- # We need to ensure that the data exists at draw time :(
- # PyOpenGL does this too
- key = '_vert_attr_'+str(indx)
- setattr(glVertexAttribPointer, key, offset_)
- ptr = offset
- ()
- # --- pyopengl
- if offset is None:
- offset = ctypes.c_void_p(0)
- elif isinstance(offset, (int, ctypes.c_int)):
- offset = ctypes.c_void_p(int(offset))
- ()
-
-
-def bindAttribLocation(program, index, name):
- # --- gl es
- name = ctypes.c_char_p(name.encode('utf-8'))
- ()
- # --- pyopengl
- name = name.encode('utf-8')
- ()
-
-
-## Setters
-
-
-def shaderSource(shader, source):
- # Some implementation do not like getting a list of single chars
- if isinstance(source, (tuple, list)):
- strings = [s for s in source]
- else:
- strings = [source]
- # --- gl es
- count = len(strings)
- string = (ctypes.c_char_p*count)(*[s.encode('utf-8') for s in strings])
- length = (ctypes.c_int*count)(*[len(s) for s in strings])
- ()
- # --- pyopengl
- GL.glShaderSource(shader, strings)
-
-
-## Getters
-
-def _getBooleanv(pname):
- # --- gl es
- params = (ctypes.c_bool*1)()
- ()
- return params[0]
-
-def _getIntegerv(pname):
- # --- gl es
- n = 16
- d = -2**31 # smallest 32bit integer
- params = (ctypes.c_int*n)(*[d for i in range(n)])
- ()
- params = [p for p in params if p!=d]
- if len(params) == 1:
- return params[0]
- else:
- return tuple(params)
-
-def _getFloatv(pname):
- # --- gl es
- n = 16
- d = float('Inf')
- params = (ctypes.c_float*n)(*[d for i in range(n)])
- ()
- params = [p for p in params if p!=d]
- if len(params) == 1:
- return params[0]
- else:
- return tuple(params)
-
-# def _getString(pname):
-# # --- gl es
-# ()
-# return res.value
-# # --- mock
-# return ''
-
-
-def getParameter(pname):
- if pname in [33902, 33901, 32773, 3106, 2931, 2928,
- 2849, 32824, 10752, 32938]:
- # GL_ALIASED_LINE_WIDTH_RANGE GL_ALIASED_POINT_SIZE_RANGE
- # GL_BLEND_COLOR GL_COLOR_CLEAR_VALUE GL_DEPTH_CLEAR_VALUE
- # GL_DEPTH_RANGE GL_LINE_WIDTH GL_POLYGON_OFFSET_FACTOR
- # GL_POLYGON_OFFSET_UNITS GL_SAMPLE_COVERAGE_VALUE
- return _glGetFloatv(pname)
- elif pname in [7936, 7937, 7938, 35724, 7939]:
- # GL_VENDOR, GL_RENDERER, GL_VERSION, GL_SHADING_LANGUAGE_VERSION,
- # GL_EXTENSIONS are strings
- pass # string handled below
- else:
- return _glGetIntegerv(pname)
- name = pname
- # --- gl es
- ()
- return ctypes.string_at(res).decode('utf-8') if res else ''
- # --- pyopengl
- res = GL.glGetString(pname)
- return res.decode('utf-8')
-
-
-def getUniform(program, location):
- # --- gl es
- n = 16
- d = float('Inf')
- params = (ctypes.c_float*n)(*[d for i in range(n)])
- ()
- params = [p for p in params if p!=d]
- if len(params) == 1:
- return params[0]
- else:
- return tuple(params)
- # --- pyopengl
- n = 16
- d = float('Inf')
- params = (ctypes.c_float*n)(*[d for i in range(n)])
- GL.glGetUniformfv(program, location, params)
- params = [p for p in params if p!=d]
- if len(params) == 1:
- return params[0]
- else:
- return tuple(params)
-
-
-def getVertexAttrib(index, pname):
- # --- gl es
- n = 4
- d = float('Inf')
- params = (ctypes.c_float*n)(*[d for i in range(n)])
- ()
- params = [p for p in params if p!=d]
- if len(params) == 1:
- return params[0]
- else:
- return tuple(params)
- # --- pyopengl
- # From PyOpenGL v3.1.0 the glGetVertexAttribfv(index, pname) does
- # work, but it always returns 4 values, with zeros in the empty
- # spaces. We have no way to tell whether they are empty or genuine
- # zeros. Fortunately, pyopengl also supports the old syntax.
- n = 4
- d = float('Inf')
- params = (ctypes.c_float*n)(*[d for i in range(n)])
- GL.glGetVertexAttribfv(index, pname, params)
- params = [p for p in params if p!=d]
- if len(params) == 1:
- return params[0]
- else:
- return tuple(params)
-
-
-def getTexParameter(target, pname):
- # --- gl es
- d = float('Inf')
- params = (ctypes.c_float*1)(d)
- ()
- return params[0]
-
-
-def getActiveAttrib(program, index):
- # --- gl es pyopengl
- bufsize = 256
- length = (ctypes.c_int*1)()
- size = (ctypes.c_int*1)()
- type = (ctypes.c_uint*1)()
- name = ctypes.create_string_buffer(bufsize)
- # --- gl es
- ()
- name = name[:length[0]].decode('utf-8')
- return name, size[0], type[0]
- # --- pyopengl
- # pyopengl has a bug, this is a patch
- GL.glGetActiveAttrib(program, index, bufsize, length, size, type, name)
- name = name[:length[0]].decode('utf-8')
- return name, size[0], type[0]
- # --- mock
- return 'mock_val', 1, 5126
-
-
-def getVertexAttribOffset(index, pname):
- # --- gl es
- pointer = (ctypes.c_void_p*1)()
- ()
- return pointer[0] or 0
- # --- pyopengl
- try: # maybe the fixed it
- ()
- except TypeError:
- pointer = (ctypes.c_void_p*1)()
- GL.glGetVertexAttribPointerv(index, pname, pointer)
- return pointer[0] or 0
- # --- mock
- return 0
-
-
-def getActiveUniform(program, index):
- # --- gl es
- bufsize = 256
- length = (ctypes.c_int*1)()
- size = (ctypes.c_int*1)()
- type = (ctypes.c_uint*1)()
- name = ctypes.create_string_buffer(bufsize)
- ()
- name = name[:length[0]].decode('utf-8')
- return name, size[0], type[0]
- # --- pyopengl
- name, size, type = GL.glGetActiveUniform(program, index)
- return name.decode('utf-8'), size, type
-
-
-def getAttachedShaders(program):
- # --- gl es
- maxcount = 256
- count = (ctypes.c_int*1)()
- shaders = (ctypes.c_uint*maxcount)()
- ()
- return tuple(shaders[:count[0]])
-
-
-def getAttribLocation(program, name):
- # --- gl es
- name = ctypes.c_char_p(name.encode('utf-8'))
- ()
- return res
- # --- pyopengl
- name = name.encode('utf-8')
- ()
-
-
-def getUniformLocation(program, name):
- # --- gl es
- name = ctypes.c_char_p(name.encode('utf-8'))
- ()
- return res
- # --- pyopengl
- name = name.encode('utf-8')
- ()
-
-def getProgramInfoLog(program):
- # --- gl es
- bufsize = 1024
- length = (ctypes.c_int*1)()
- infolog = ctypes.create_string_buffer(bufsize)
- ()
- return infolog[:length[0]].decode('utf-8')
- # --- pyopengl
- res = GL.glGetProgramInfoLog(program)
- return res.decode('utf-8') if isinstance(res, bytes) else res
-
-def getShaderInfoLog(shader):
- # --- gl es
- bufsize = 1024
- length = (ctypes.c_int*1)()
- infolog = ctypes.create_string_buffer(bufsize)
- ()
- return infolog[:length[0]].decode('utf-8')
- # --- pyopengl
- res = GL.glGetShaderInfoLog(shader)
- return res.decode('utf-8') if isinstance(res, bytes) else res
-
-def getProgramParameter(program, pname):
- # --- gl es
- params = (ctypes.c_int*1)()
- ()
- return params[0]
-
-def getShaderParameter(shader, pname):
- # --- gl es
- params = (ctypes.c_int*1)()
- ()
- return params[0]
-
-def getShaderPrecisionFormat(shadertype, precisiontype):
- # --- gl es
- range = (ctypes.c_int*1)()
- precision = (ctypes.c_int*1)()
- ()
- return range[0], precision[0]
-
-def getShaderSource(shader):
- # --- gl es
- bufsize = 1024*1024
- length = (ctypes.c_int*1)()
- source = (ctypes.c_char*bufsize)()
- ()
- return source.value[:length[0]].decode('utf-8')
- # --- pyopengl
- res = GL.glGetShaderSource(shader)
- return res.decode('utf-8')
-
-
-def getBufferParameter(target, pname):
- # --- gl es
- d = -2**31 # smallest 32bit integer
- params = (ctypes.c_int*1)(d)
- ()
- return params[0]
-
-
-def getFramebufferAttachmentParameter(target, attachment, pname):
- # --- gl es
- d = -2**31 # smallest 32bit integer
- params = (ctypes.c_int*1)(d)
- ()
- return params[0]
- # --- pyopengl
- d = -2**31 # smallest 32bit integer
- params = (ctypes.c_int*1)(d)
- FBO.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params)
- return params[0]
-
-
-def getRenderbufferParameter(target, pname):
- # --- gl es
- d = -2**31 # smallest 32bit integer
- params = (ctypes.c_int*1)(d)
- ()
- return params[0]
- # --- pyopengl
- d = -2**31 # smallest 32bit integer
- params = (ctypes.c_int*1)(d)
- FBO.glGetRenderbufferParameteriv(target, pname, params)
- return params[0]
-
-
-
-## ============================================================================
-
-
-class FunctionAnnotation:
- def __init__(self, name, args, output):
- self.name = name
- self.args = args
- self.output = output
- self.lines = [] # (line, comment) tuples
-
- def __repr__(self):
- return '<FunctionAnnotation for %s>' % self.name
-
- def get_lines(self, call, backend):
- """ Get the lines for this function based on the given backend.
- The given API call is inserted at the correct location.
- """
- backend_selector = (backend, ) # first lines are for all backends
- lines = []
- for line in self.lines:
- if line.lstrip().startswith('# ---'):
- backend_selector = line.strip().split(' ')
- continue
- if backend in backend_selector:
- if line.strip() == '()':
- indent = line.split('(')[0][4:]
- line = indent + call
- lines.append(line)
- return lines
-
- def is_arg_set(self, name):
- """ Get whether a given variable name is set.
- This allows checking whether a variable that is an input to the C
- function is not an input for the Python function, and may be an output.
- """
- needle = '%s =' % name
- for line, comment in self.lines:
- if line.startswith(needle):
- return True
- else:
- return False
-
-
-
-def parse_anotations():
- """ Parse this annotations file and produce a dictionary of
- FunctionAnnotation objects.
- """
-
- functions = {}
- function = None
-
- for line in open(__file__, 'rt').readlines():
- # Stop?
- if '='*40 in line:
- break
-
- if line.startswith('def '):
- name = line.split(' ')[1].split('(')[0]
- args = line.split('(')[1].split(')')[0].split(', ')
- args = [arg for arg in args if arg]
- out = line.partition('->')[2].strip()
- function = FunctionAnnotation(name, args, out)
- functions[name] = function
- continue
- elif not function:
- continue
-
- # Add line
- line = line.rstrip()
- indent = len(line) - len(line.strip())
- if line.strip() and indent >=4:
- function.lines.append(line)
-
- return functions
-
-
-if __name__ == '__main__':
- print(parse_anotations().keys())
-
\ No newline at end of file
diff --git a/codegen/createglapi.py b/codegen/createglapi.py
deleted file mode 100644
index 3f5dcda..0000000
--- a/codegen/createglapi.py
+++ /dev/null
@@ -1,791 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# Copyright (c) 2013, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Scipt to generate code for our gl API, including all its backends.
-
-The files involved in the code generation process are:
-
- * gl2.h - the C header file for the GL ES 2.0 API
- * webgl.idl - the interface definition language for WebGL
- * annotations.py - manual annotations for non-trivial functions
- * headerparser.py - parses .h and .idl files
- * createglapi.py - uses all of the above to generate the actual code
-
-Rationale
----------
-
-The GL ES 2.0 API is relatively small. Therefore a fully automated build
-process like PyOpenGL now has is not really necessary. I tried to
-automate what we can and simply do the rest with manual annotations.
-Some groups of functions (like glUniform and friends) are handled in
-*this* file.
-
-Even though the API is quite small, we want to generate several
-implementations, such as gl2 (desktop), es2 (angle on Windows), a generic
-proxy, a mock backend and possibly more. Therefore automation
-is crucial.
-
-Further notes
--------------
-
-This file is pretty big and even though I tried to make the code as clear
-as possible, it's not always that easy to read. In effect this code is
-not so easy to maintain. I hope it is at least clear enough so it can be
-used to maintain the GL API itself.
-
-This function must be run using Python3.
-"""
-
-import os
-import ctypes # not actually used, but handy to have imported during dev
-
-import headerparser
-from annotations import parse_anotations
-
-from OpenGL import GL # For checking
-
-THISDIR = os.path.abspath(os.path.dirname(__file__))
-GLDIR = os.path.join(THISDIR, '..', 'vispy', 'gloo', 'gl')
-
-PREAMBLE = '''"""
-
-THIS CODE IS AUTO-GENERATED. DO NOT EDIT.
-
-%s
-
-"""
-'''
-
-## Create parsers
-
-# Create a parser for gl2 and es2
-parser1 = headerparser.Parser(os.path.join(THISDIR, 'headers', 'gl2.h'))
-headerparser.CONSTANTS = {}
-parser2 = headerparser.Parser(os.path.join(THISDIR, 'headers', 'webgl.idl'))
-
-# Get annotations
-annotations = parse_anotations()
-
-
-## Check constants and generate API module
-
-# Get names
-names1 = set(parser1.constant_names)
-names2 = set(parser2.constant_names)
-
-# Check names correspondence
-if names1 == names2:
- print('Constants in gl2 and webgl are equal')
-else:
- print('===== Extra names in gl2 =====')
- print(', '.join(names1.difference(names2)))
- print('===== Extra names in webgl =====')
- print(', '.join(names2.difference(names1)))
- print('===========')
-
-# Test value correspondence
-superset = names1.intersection(names2)
-#
-constants = {}
-for c1 in parser1.constants.values():
- if c1.shortname in superset:
- constants[c1.shortname] = c1.value
-#
-assert len(constants) == len(superset)
-#
-for c2 in parser2.constants.values():
- if c2.shortname in constants:
- assert c2.value == constants[c2.shortname]
-print('Hooray! All constants that occur in both namespaces have equal values.')
-
-
-DEFINE_ENUM = """
-class Enum(int):
- ''' Enum (integer) with a meaningfull repr. '''
- def __new__(cls, name, value):
- base = int.__new__(cls, value)
- base.name = name
- return base
- def __repr__(self):
- return self.name
-"""
-
-DEFINE_CONST_MAP = """
-ENUM_MAP = {}
-for ob in list(globals().values()):
- if repr(ob).startswith('GL_'):
- ENUM_MAP[int(ob)] = ob
-del ob
-"""
-
-def create_constants_module(parser, extension=False):
-
- # Initialize
- lines = []
- lines.append(PREAMBLE % 'Constants for OpenGL ES 2.0.')
-
- # Define ENUM
- lines.append(DEFINE_ENUM)
- lines.append('')
-
- # For extensions, we only take the OES ones, and remove the OES
- if extension:
- constantDefs = []
- for c in parser.constants.values():
- if 'OES' in c.oname:
- c.oname = c.oname.replace('OES','')
- c.oname = c.oname.replace('__','_').strip('_')
- constantDefs.append(c)
- else:
- constantDefs = parser.constants.values()
-
- # Insert constants
- for c in sorted(constantDefs, key=lambda x: x.oname):
- if isinstance(c.value, int):
- lines.append('%s = Enum(%r, %r)' % (c.oname, c.oname, c.value))
- else:
- lines.append('%s = %r' % (c.oname, c.value))
- lines.append('')
-
- lines.append(DEFINE_CONST_MAP)
-
- # Write the file
- fname = '_constants_ext.py' if extension else '_constants.py'
- with open(os.path.join(GLDIR, fname), 'wb') as f:
- f.write(('\n'.join(lines)).encode('utf-8'))
- print('wrote %s' % fname)
-
-
-create_constants_module(parser1)
-
-
-## List functions
-
-IGNORE_FUNCTIONS = ['releaseShaderCompiler', 'shaderBinary']
-
-WEBGL_EQUIVALENTS = {
- 'genBuffers': 'createBuffer',
- 'genFramebuffers': 'createFramebuffer',
- 'genRenderbuffers': 'createRenderbuffer',
- 'genTextures': 'createTexture',
-
- 'deleteBuffers': 'deleteBuffer',
- 'deleteFramebuffers': 'deleteFramebuffer',
- 'deleteRenderbuffers': 'deleteRenderbuffer',
- 'deleteTextures': 'deleteTexture',
-
- 'clearDepthf': 'clearDepth',
- 'depthRangef': 'depthRange',
-
- 'getBufferParameteriv': 'getBufferParameter',
- 'getRenderbufferParameteriv': 'getRenderbufferParameter',
- 'getFramebufferAttachmentParameteriv': 'getFramebufferAttachmentParameter',
-
- 'getVertexAttribPointerv': 'getVertexAttribOffset',
-
- 'getProgramiv': 'getProgramParameter',
- 'getShaderiv': 'getShaderParameter',
-
- 'getBooleanv': 'getParameter',
- 'getFloatv': 'getParameter',
- 'getIntegerv': 'getParameter',
- 'getString': 'getParameter', # getParameter is getString + getFloat
- }
-
-# Types that we convert easily from Python to C (and back)
-EASY_TYPES = { 'void': (type(None), 'c_voidp'), # only for output
- 'GLenum': (int, 'c_uint'),
- 'GLboolean': (bool, 'c_bool'),
- 'GLuint': (int, 'c_uint'),
- 'GLint': (int, 'c_int'),
- 'GLbitfield': (int, 'c_uint'),
- 'GLsizei': (int, 'c_int'),
- 'GLfloat': (float, 'c_float'),
- 'GLclampf': (float, 'c_float'),
- }
-
-# Types that dont map 1-on-1 to Python values, but that we know
-# how to set the ctypes argtypes for.
-HARDER_TYPES = {
- 'GLenum*':('', 'POINTER(ctypes.c_uint)'),
- 'GLboolean*':('', 'POINTER(ctypes.c_bool)'),
- 'GLuint*':('', 'POINTER(ctypes.c_uint)'),
- 'GLint*':('', 'POINTER(ctypes.c_int)'),
- 'GLsizei*':('', 'POINTER(ctypes.c_int)'),
- 'GLfloat*':('', 'POINTER(ctypes.c_float)'),
-
- 'GLubyte*':('', 'c_char_p'),
- 'GLchar*':('', 'c_char_p'),
- 'GLchar**':('', 'POINTER(ctypes.c_char_p)'),
- 'GLvoid*':('', 'c_void_p'), # or c_voidp?
- 'GLvoid**':('', 'POINTER(ctypes.c_void_p)'),
- 'GLintptr':('', 'c_int'),
- 'GLsizeiptr':('', 'c_int'),
- }
-
-# Together the EASY_TYPES and HARDER_TYPES should cover all types that
-# ES 2.0 uses.
-KNOWN_TYPES = EASY_TYPES.copy()
-KNOWN_TYPES.update(HARDER_TYPES)
-
-
-def apiname(funcname):
- """ Define what name the API uses, the short or the gl version.
- """
- if funcname.startswith('gl'):
- return funcname
- else:
- if funcname.startswith('_'):
- return '_gl' + funcname[1].upper() + funcname[2:]
- else:
- return 'gl' + funcname[0].upper() + funcname[1:]
-
-
-class FunctionDescription:
- def __init__(self, name, es2func, wglfunc, annfunc):
- self.name = name
- self.apiname = apiname(name)
- self.es2 = es2func
- self.wgl = wglfunc
- self.ann = annfunc
- self.args = []
-
-
-# Keep track of what webGL names we "used"
-used_webgl_names = set()
-
-# Also keep track of what functions we could handle automatically,
-# and which not. Just for reporting.
-functions_auto = set()
-functions_anno = set()
-functions_todo = set()
-
-
-def combine_function_definitions():
- """ Process function definitions of ES 2.0, WebGL and annotations.
- We try to combine information from these three sources to find the
- arguments for the Python API. In this "merging" process we also
- check for inconsistencies between the API definitions.
- """
- functions = []
- have_getParameter = False
-
- for name in parser1.function_names:
- if name in IGNORE_FUNCTIONS:
- continue
-
- # Get es2 function
- es2func = parser1.functions[name]
-
- # Get webgl version
- lookupname = WEBGL_EQUIVALENTS.get(es2func.shortname, es2func.shortname)
- wglfunc = parser2.functions.get(lookupname, None)
- if wglfunc:
- used_webgl_names.add(lookupname)
- else:
- print('WARNING: %s not available in WebGL' % es2func.shortname)
-
- # Convert name
- name = WEBGL_EQUIVALENTS.get(name, name)
-
- # Avoid duplicates for getParameter
- if name == 'getParameter':
- if es2func.shortname != 'getString':
- name = '_' + es2func.shortname
-
- # Get annotated version
- annfunc = annotations.get(name, None)
-
- # Create description instance
- des = FunctionDescription(name, es2func, wglfunc, annfunc)
- functions.append(des)
-
- # Get information about arguments
- if True:
- argnames_es2 = [arg.name for arg in es2func.args[1:]]
- if wglfunc:
- argnames_wgl = [arg.name for arg in wglfunc.args[1:]]
- if annfunc:
- argnames_ann = annfunc.args # Can contain 'argname=default'
- argnames_ann = [arg.split('=')[0] for arg in argnames_ann]
-
- # Set argumenets specification of our GL API
- # Also check and report when we deviate from the WebGL API
- if wglfunc and argnames_es2 == argnames_wgl:
- if annfunc and argnames_ann != argnames_es2:
- des.args = argnames_ann
- print('WARNING: %s: Annotation overload even though webgl and es2 match.'%name)
- else:
- des.args = argnames_es2
- elif wglfunc:
- if annfunc and argnames_ann != argnames_wgl:
- des.args = argnames_ann
- print('WARNING: %s: Annotation overload webgl args.'%name)
- else:
- #print('WARNING: %s: assuming wgl args.'%name)
- des.args = argnames_wgl
- else:
- print('WARNING: %s: Could not determine args!!'%name)
-
- # Go over all functions to test if they are in OpenGL
- for func in [es2func, wglfunc]:
- if func is None:
- continue
- group = func.group or [func]
- for f in group:
- # Check opengl
- if f.oname.startswith('gl') and not hasattr(GL, f.glname):
- print('WARNING: %s seems not available in PyOpenGL' % f.glname)
-
- return functions
-
-
-## Get full function definitions and report
-# Get functions
-functions = combine_function_definitions()
-
-# Check which WebGL functions we did not find/use
-for name in set(parser2.function_names).difference(used_webgl_names):
- print('WARNING: WebGL function %s not in Desktop' % name)
-
-# Report status
-print('Could generate %i functions automatically, and %i with annotations' %
- (len(functions_auto), len(functions_anno)))
-print('Need more info for %i functions.' % len(functions_todo))
-if not functions_todo:
- print('Hooray! All %i functions are covered!' % len(functions))
-
-
-
-## Define generators
-
-class ApiGenerator:
- """ Base API generator class. We derive several subclasses to implement
- the different backends.
- """
-
- DESCRIPTION = "GL API X"
- PREAMBLE = ""
-
- def __init__(self):
- self.lines = []
-
- def save(self):
- # Remove too many whitespace
- text = '\n'.join(self.lines) + '\n'
- for i in range(10):
- text = text.replace('\n\n\n\n', '\n\n\n')
- # Write
- with open(self.filename, 'wb') as f:
- f.write((PREAMBLE % self.DESCRIPTION).encode('utf-8'))
- for line in self.PREAMBLE.splitlines():
- f.write(line[4:].encode('utf-8')+b'\n')
- f.write(b'\n')
- f.write(text.encode('utf-8'))
-
- def add_function(self, des):
- if des.es2.group:
- if des.name.startswith('get'):
- assert len(des.es2.group) == 2 # vi and fv
- des.es2 = des.es2.group[0] # f comes before 1
- self._add_function(des)
- else:
- self._add_function_group(des)
- else:
- self._add_function(des)
- self.lines.append('\n') # two lines between each function
-
-
- def _add_function_group(self, des):
- lines = self.lines
- handled = True
-
- # Create map to es2 function objects
- es2funcs = {}
- for f in des.es2.group:
- cname = f.shortname
- es2funcs[cname] = f
-
- if des.name == 'uniform':
- for t in ('float', 'int'):
- for i in (1,2,3,4):
- args = ', '.join(['v%i'%j for j in range(1,i+1)])
- cname = 'uniform%i%s' % (i, t[0])
- sig = '%s(location, %s)' % (apiname(cname), args)
- self._add_group_function(des, sig, es2funcs[cname])
- for t in ('float', 'int'):
- for i in (1,2,3,4):
- cname = 'uniform%i%sv' % (i, t[0])
- sig = '%s(location, count, values)' % apiname(cname)
- self._add_group_function(des, sig, es2funcs[cname])
- elif des.name == 'uniformMatrix':
- for i in (2,3,4):
- cname = 'uniformMatrix%ifv' % i
- sig = '%s(location, count, transpose, values)' % apiname(cname)
- self._add_group_function(des, sig, es2funcs[cname])
- elif des.name == 'vertexAttrib':
- for i in (1,2,3,4):
- args = ', '.join(['v%i'%j for j in range(1,i+1)])
- cname = 'vertexAttrib%if' % i
- sig = '%s(index, %s)' % (apiname(cname), args)
- self._add_group_function(des, sig, es2funcs[cname])
- elif des.name == 'texParameter':
- for t in ('float', 'int'):
- cname = 'texParameter%s' % t[0]
- sig = '%s(target, pname, param)' % apiname(cname)
- self._add_group_function(des, sig, es2funcs[cname])
- else:
- handled = False
-
- if handled:
- functions_auto.add(des.name)
- else:
- functions_todo.add(des.name)
- lines.append('# todo: Dont know group %s' % des.name)
-
- def _add_function(self, des):
- # Need to be overloaded in subclass
- raise NotImplementedError()
-
- def _add_group_function(self, des, sig, es2func):
- # Need to be overloaded in subclass
- raise NotImplementedError()
-
-
-
-class ProxyApiGenerator(ApiGenerator):
- """ Generator for the general proxy class that will be loaded into gloo.gl.
- """
-
- filename = os.path.join(GLDIR, '_proxy.py')
- DESCRIPTION = 'Base proxy API for GL ES 2.0.'
- PREAMBLE = '''
- class BaseGLProxy(object):
- """ Base proxy class for the GL ES 2.0 API. Subclasses should
- implement __call__ to process the API calls.
- """
-
- def __call__(self, funcname, returns, *args):
- raise NotImplementedError()
- '''
-
- def _returns(self, des):
- shortame = des.name
- for prefix in ("get", "is", "check", "create", "read"):
- if shortame.startswith(prefix):
- return True
- else:
- return False
-
-
- def _add_function(self, des):
- ret = self._returns(des)
- prefix = 'return ' if ret else ''
- argstr = ', '.join(des.args)
- self.lines.append(' def %s(self, %s):' % (des.apiname, argstr))
- self.lines.append(' %sself("%s", %r, %s)' %
- (prefix, apiname(des.name),ret, argstr))
-
- def _add_group_function(self, des, sig, es2func):
- ret = self._returns(des)
- prefix = 'return ' if ret else ''
- funcname = apiname(sig.split('(')[0])
- args = sig.split('(', 1)[1].split(')')[0]
- #self.lines.append(' def %s:' % sig)
- self.lines.append(' def %s(self, %s):' % (funcname, args))
- self.lines.append(' %sself("%s", %r, %s)' %
- (prefix, funcname, ret, args))
-
-
-
-class Gl2ApiGenerator(ApiGenerator):
- """ Generator for the gl2 (desktop) backend.
- """
-
- filename = os.path.join(GLDIR, '_gl2.py')
- write_c_sig = True
- define_argtypes_in_module = False
-
- DESCRIPTION = "Subset of desktop GL API compatible with GL ES 2.0"
- PREAMBLE = """
- import ctypes
- from .gl2 import _lib, _get_gl_func
- """
-
- def _get_argtype_str(self, es2func):
- ce_arg_types = [arg.ctype for arg in es2func.args[1:]]
- ct_arg_types = [KNOWN_TYPES.get(arg.ctype, None) for arg in es2func.args]
- # Set argument types on ctypes function
- if None in ct_arg_types:
- argstr = 'UNKNOWN_ARGTYPES'
- elif es2func.group:
- argstr = 'UNKNOWN_ARGTYPES'
- else:
- argstr = ', '.join(['ctypes.%s' % t[1] for t in ct_arg_types[1:]])
- argstr = '()' if not argstr else '(%s,)' % argstr
- # Set output arg (if available)
- if ct_arg_types[0][0] != type(None):
- resstr = 'ctypes.%s' % ct_arg_types[0][1]
- else:
- resstr = 'None'
- return resstr, argstr
-
-
- def _write_argtypes(self, es2func):
- lines = self.lines
- ce_arg_types = [arg.ctype for arg in es2func.args[1:]]
- ct_arg_types = [KNOWN_TYPES.get(arg.ctype, None) for arg in es2func.args]
- # Set argument types on ctypes function
- if None in ct_arg_types:
- lines.append('# todo: unknown argtypes')
- elif es2func.group:
- lines.append('# todo: oops, dont set argtypes for group!')
- else:
- if ct_arg_types[1:]:
- argstr = ', '.join(['ctypes.%s' % t[1] for t in ct_arg_types[1:]])
- lines.append('_lib.%s.argtypes = %s,' % (es2func.glname, argstr))
- else:
- lines.append('_lib.%s.argtypes = ()' % es2func.glname)
- # Set output arg (if available)
- if ct_arg_types[0][0] != type(None):
- lines.append('_lib.%s.restype = ctypes.%s' % (es2func.glname, ct_arg_types[0][1]))
-
- def _native_call_line(self, name, es2func, cargstr=None, prefix='', indent=4):
- #'_lib.%s(%s)' % (des.es2.glname, cargstr)
- resstr, argstr = self._get_argtype_str(es2func)
- if cargstr is None:
- cargs = [arg.name for arg in es2func.args[1:]]
- cargstr = ', '.join(cargs)
-
- lines = 'try:\n'
- lines += ' nativefunc = %s._native\n' % apiname(name)
- lines += 'except AttributeError:\n'
- lines += ' nativefunc = %s._native = _get_gl_func("%s", %s, %s)\n' % (
- apiname(name), es2func.glname, resstr, argstr)
- lines += '%snativefunc(%s)\n' % (prefix, cargstr)
-
- #lines += 'check_error("%s")' % name
-
- lines = [' '*indent + line for line in lines.splitlines()]
- return '\n'.join(lines)
-
-
- def _add_function(self, des):
- lines = self.lines
- es2func = des.es2
-
- # Write arg types
- if self.define_argtypes_in_module:
- self._write_argtypes(es2func)
-
- # Get names and types of C-API
- ce_arg_types = [arg.ctype for arg in es2func.args[1:]]
- ce_arg_names = [arg.name for arg in es2func.args[1:]]
- ct_arg_types = [KNOWN_TYPES.get(arg.ctype, None) for arg in es2func.args]
- ct_arg_types_easy = [EASY_TYPES.get(arg.ctype, None) for arg in es2func.args]
-
- # Write C function signature, for debugging and development
- if self.write_c_sig:
- argnamesstr = ', '.join([c_type+' '+c_name for c_type, c_name in zip(ce_arg_types, ce_arg_names)])
- lines.append('# %s = %s(%s)' % (es2func.args[0].ctype, es2func.oname, argnamesstr))
-
- # Write Python function def
- lines.append('def %s(%s):' % (des.apiname, ', '.join(des.args)))
-
- # Construct C function call
- cargs = [arg.name for arg in des.es2.args[1:]]
- cargstr = ', '.join(cargs)
- #callline = '_lib.%s(%s)' % (des.es2.glname, cargstr)
-
- # Now write the body of the function ...
- if des.ann:
- prefix = 'res = '
- # Annotation available
- functions_anno.add(des.name)
- callline = self._native_call_line(des.name, es2func, prefix=prefix)
- lines.extend( des.ann.get_lines(callline, 'gl') )
-
- elif es2func.group:
- # Group?
- functions_todo.add(des.name)
- lines.append(' pass # todo: Oops. this is a group!')
- elif None in ct_arg_types_easy:
- functions_todo.add(des.name)
- lines.append(' pass # todo: Not all easy types!')
- elif des.args != [arg.name for arg in des.wgl.args[1:]]:
- functions_todo.add(des.name)
- lines.append(' pass # todo: ES 2.0 and WebGL args do not match!')
- else:
- # This one is easy!
- functions_auto.add(des.name)
- # Get prefix
- prefix = ''
- if ct_arg_types[0][0] != type(None):
- prefix = 'return '
- elif des.es2.shortname.startswith('get'):
- raise RuntimeError('Get func returns void?')
- # Set string
- callline = self._native_call_line(des.name, des.es2, prefix=prefix)
- lines.append(callline)
-
-
- if 'gl2' in self.__class__.__name__.lower():
- # Post-fix special cases for gl2. See discussion in #201
- # glDepthRangef and glClearDepthf are not always available,
- # and sometimes they do not work if they are
- if es2func.oname in ('glDepthRangef', 'glClearDepthf'):
- for i in range(1,10):
- line = lines[-i]
- if not line.strip() or line.startswith('#'):
- break
- line = line.replace('c_float', 'c_double')
- line = line.replace('glDepthRangef', 'glDepthRange')
- line = line.replace('glClearDepthf', 'glClearDepth')
- lines[-i] = line
-
-
- def _add_group_function(self, des, sig, es2func):
- lines = self.lines
- handled = True
-
- call_line = self._native_call_line
-
- if self.define_argtypes_in_module:
- self._write_argtypes(es2func)
-
- funcname = sig.split('(', 1)[0]
- args = sig.split('(', 1)[1].split(')')[0]
- cfuncname = 'gl' + funcname[0].upper() + funcname[1:]
-
- if des.name == 'uniform':
- if funcname[-1] != 'v':
- lines.append('def %s:' % sig)
- lines.append(call_line(funcname, es2func, args))
- else:
- t = {'f':'float', 'i':'int'}[funcname[-2]]
- lines.append('def %s:' % sig)
- lines.append(' values = [%s(val) for val in values]' % t)
- lines.append(' values = (ctypes.c_%s*len(values))(*values)' % t)
- lines.append(call_line(funcname, es2func, 'location, count, values'))
- elif des.name == 'uniformMatrix':
- lines.append('def %s:' % sig)
- lines.append(' if not values.flags["C_CONTIGUOUS"]:')
- lines.append(' values = values.copy()')
- lines.append(' assert values.dtype.name == "float32"')
- lines.append(' values_ = values')
- lines.append(' values = values_.ctypes.data_as(ctypes.POINTER(ctypes.c_float))')
- lines.append(call_line(funcname, es2func, 'location, count, transpose, values'))
- elif des.name == 'vertexAttrib':
- lines.append('def %s:' % sig)
- lines.append(call_line(funcname, es2func, args))
- elif des.name == 'texParameter':
- lines.append('def %s:' % sig)
- lines.append(call_line(funcname, es2func, args))
-
- else:
- raise ValueError('unknown group func')
-
-
-class Es2ApiGenrator(Gl2ApiGenerator):
- """ Generator for the es2 backend (i.e. Angle on Windows). Very
- similar to the gl2 API, but we do not need that deferred loading
- of GL functions here.
- """
-
- filename = os.path.join(GLDIR, '_es2.py')
- write_c_sig = True
- define_argtypes_in_module = True
-
- DESCRIPTION = "GL ES 2.0 API (via Angle/DirectX on Windows)"
- PREAMBLE = """
- import ctypes
- from .es2 import _lib
- """
-
- def _native_call_line(self, name, es2func, cargstr=None, prefix='', indent=4):
- resstr, argstr = self._get_argtype_str(es2func)
- if cargstr is None:
- cargs = [arg.name for arg in es2func.args[1:]]
- cargstr = ', '.join(cargs)
- return ' '*indent + '%s_lib.%s(%s)' % (prefix, es2func.glname, cargstr)
-
-
-
-class PyOpenGL2ApiGenrator(ApiGenerator):
- """ Generator for a fallback pyopengl backend.
- """
-
- filename = os.path.join(GLDIR, '_pyopengl2.py')
- DESCRIPTION = 'Proxy API for GL ES 2.0 subset, via the PyOpenGL library.'
- PREAMBLE = """
- import ctypes
- from OpenGL import GL
- import OpenGL.GL.framebufferobjects as FBO
- """
-
- def __init__(self):
- ApiGenerator.__init__(self)
- self._functions_to_import = []
- self._used_functions = []
-
- def _add_function(self, des):
- # Fix for FBO?
- mod = 'GL'
- if 'renderbuffer' in des.name.lower() or 'framebuffer' in des.name.lower():
- mod = 'FBO'
- # Get call line
- argstr = ', '.join(des.args)
- call_line = ' return %s.%s(%s)' % (mod, des.es2.glname, argstr)
- # Get annotation lines
- ann_lines = []
- if des.ann is not None:
- ann_lines = des.ann.get_lines(call_line, 'pyopengl')
- # Use annotation or not
- if ann_lines:
- self.lines.append('def %s(%s):' % (des.apiname, argstr))
- self.lines.extend(ann_lines)
- self._used_functions.append(des.es2.glname)
- else:
- # To be imported from OpenGL.GL
- self._functions_to_import.append((des.es2.glname, des.apiname))
-
- def _add_group_function(self, des, sig, es2func):
- # All group functions can be directly imported from OpenGL
- funcname = apiname(sig.split('(')[0])
- self._functions_to_import.append((funcname, funcname))
-
- def save(self):
- # Write remaining functions
- self.lines.append('# List of functions that we should import from OpenGL.GL')
- self.lines.append('_functions_to_import = [')
- for name1, name2 in self._functions_to_import:
- self.lines.append(' ("%s", "%s"),' % (name1, name2))
- self.lines.append(' ]')
-
- self.lines.append('')
-
- # Write used functions
- self.lines.append('# List of functions in OpenGL.GL that we use')
- self.lines.append('_used_functions = [')
- for name in self._used_functions:
- self.lines.append(' "%s",' % name)
- self.lines.append(' ]')
-
- # Really save
- ApiGenerator.save(self)
-
-
-## Generate
-
-# Generate
-for Gen in [ProxyApiGenerator, Gl2ApiGenerator, Es2ApiGenrator,
- PyOpenGL2ApiGenrator]:
- gen = Gen()
- for des in functions:
- gen.add_function(des)
- gen.save()
-
-
diff --git a/codegen/get-deprecated.py b/codegen/get-deprecated.py
deleted file mode 100644
index 955e896..0000000
--- a/codegen/get-deprecated.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# Copyright (c) 2013, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-""" Get deprecated funcsions by parsing gl.spec.
-
-gl.spec is not included in the repo for reasons of space. But you can
-easily download it.
-"""
-
-import os
-import sys
-
-THISDIR = os.path.abspath(os.path.dirname(__file__))
-
-# Load text
-filename = os.path.join(THISDIR, 'headers', 'gl.spec')
-text = open(filename, 'rb').read().decode('utf-8')
-
-# Define chars that a function name must begin with
-chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-assert len(chars) == 26
-
-
-# Get deprecated functions
-
-deprecated = set()
-
-currentFunc = None
-for line in text.splitlines():
- if line.endswith(')') and '(' in line and line[0] in chars:
- currentFunc = line.split('(')[0]
-
- elif not currentFunc:
- pass
-
- elif line.startswith('\t'):
- line = line.replace('\t', ' ')
- parts = line.split(' ')
- parts = [part.strip() for part in parts]
- parts = [part for part in parts if part]
- key = parts[0]
- if len(parts) > 1 :
- val, comment = parts[1], parts[2:]
- if key == 'deprecated' and float(val) <= 3.1:
- deprecated.add(currentFunc)
-
-
-assert 'Begin' in deprecated
-
-
-# Print
-
-print('='*80)
-
-pendingline = ' '
-for name in sorted(deprecated):
- name = 'gl' + name
- if len(pendingline) + len(name) < 77:
- pendingline += name + ', '
- else:
- print(pendingline)
- pendingline = ' ' + name + ', '
-print(pendingline)
-print('='*80)
-
-# Report
-print('Found %i deprecated functions' % len(deprecated) )
diff --git a/codegen/headerparser.py b/codegen/headerparser.py
deleted file mode 100644
index 6b2c970..0000000
--- a/codegen/headerparser.py
+++ /dev/null
@@ -1,370 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2013, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-""" Code to parse a header file and create a list of constants,
-functions (with arguments). This information can then be used to
-autogenerate our OpenGL API.
-"""
-
-import os
-import sys
-
-
-def getwords(line):
- """ Get words on a line.
- """
- line = line.replace('\t', ' ').strip()
- return [w for w in line.split(' ') if w]
-
-
-# Keep track of all constants in case they are "reused" (i.e. aliases)
-CONSTANTS = {}
-
-
-class Parser:
- """ Class to parse header files. It can deal with gl2.h and webgl.idl,
- as well as some desktop OpenGL header files. It produces a list of
- ConstantDefition objects and FunctionDefinition objects, which can
- be accessed via a dict.
- """
-
- def __init__(self, header_file, parse_now=True):
- # Get filenames for C and Py
- self._c_fname = c_fname = os.path.split(header_file)[1]
-
- # Get absolute filenames
- self._c_filename = header_file
-
- # Init intermediate results
- self._functionDefs = []
- self._constantDefs = []
-
- # Init output
- self._functions = {}
- self._constants = {}
-
- # We are aware of the line number
- self._linenr = 0
-
- # Some stats
- self.stat_types = set()
-
- if parse_now:
- self.parse()
-
- def __iadd__(self, definition):
- """ Add an output line. Can be multiple lines.
- """
- # Create comment
- definition.comment = 'line %i of %s' % (self._linenr, self._c_fname)
- # Add to lists
- if isinstance(definition, FunctionDefinition):
- self._functionDefs.append(definition)
- elif isinstance(definition, ConstantDefinition):
- self._constantDefs.append(definition)
- return self
-
- def _get_line(self):
- # Get a stripped line, and keep track of line nr, skip empty lines
- line = ''
- while not line:
- line = self._file.readline()
- if not line:
- raise StopIteration()
- line = line.strip()
- self._linenr += 1
- return line
-
- def _get_lines(self):
- # Easy iterator
- while True:
- yield self._get_line()
-
- def parse(self):
- """ Parse the header file!
- """
-
- # Open file
- self._file = open(self._c_filename, 'rt', encoding='utf-8')
-
- # Parse the file
- for line in self._get_lines():
- if line.startswith('#define'):
- self += ConstantDefinition(line)
- elif line.startswith('const GLenum'):
- self += ConstantDefinition(line)
- elif '(' in line:
- while ')' not in line:
- line += self._get_line()
- if line.endswith(');'):
- self += FunctionDefinition(line)
-
- # Remove invalid defs
- self._functionDefs = [d for d in self._functionDefs if d.isvalid]
- self._constantDefs = [d for d in self._constantDefs if d.isvalid]
-
- # Collect multipe similar functions in groups
- self._functionDefs.sort(key=lambda x: x.glname)
- keyDef = None
- keyDefs = []
- for funcDef in [f for f in self._functionDefs]:
- # Check if we need a new keydef
- if funcDef.extrachars:
- # Create new keydef or use old one?
- if keyDef and keyDef.glname == funcDef.keyname:
- pass # Keep same keydef
- else:
- keyDef = FunctionGroup(funcDef.line) # New keydef
- keyDef._set_name(funcDef.keyname)
- keyDefs.append(keyDef)
- # Add to group
- keyDef.group.append(funcDef)
- # Process function groups
- for keyDef in keyDefs:
- if len(keyDef.group) > 1:
- self._functionDefs.append(keyDef)
- for d in keyDef.group:
- self._functionDefs.remove(d)
-
- # Sort constants and functions
- self._functionDefs.sort(key=lambda x: x.glname)
- self._constantDefs.sort(key=lambda x: x.glname)
-
- # Get dicts
- for definition in self._functionDefs:
- self._functions[definition.shortname] = definition
- for definition in self._constantDefs:
- self._constants[definition.shortname] = definition
-
- # Get some stats
- for funcDef in self._functionDefs:
- for arg in funcDef.args:
- self.stat_types.add(arg.ctype)
-
- # Show stats
- n1 = len([d for d in self._constantDefs])
- n2 = len([d for d in self._functionDefs])
- n3 = len([d for d in self._functionDefs if d.group])
- n4 = sum([len(d.group) for d in self._functionDefs if d.group])
- print('Found %i constants and %i unique functions (%i groups contain %i functions)").' % (
- n1, n2, n3, n4))
-
- print('C-types found in args:', self.stat_types)
-
- @property
- def constant_names(self):
- """ Sorted list of constant names.
- """
- return [d.shortname for d in self._constantDefs]
-
- @property
- def function_names(self):
- """ Sorted list of function names.
- """
- return [d.shortname for d in self._functionDefs]
-
- @property
- def constants(self):
- """ Dict with all the constants.
- """
- return self._constants
-
- @property
- def functions(self):
- """ Dict witj all the functions.
- """
- return self._functions
-
- def show_groups(self):
- for d in self._functionDefs:
- if isinstance(d.group, list):
- print(d.keyname)
- for d2 in d.group:
- print(' ', d2.glname)
-
-
-
-class Definition:
- """ Abstract class to represent a constant or function definition.
- """
-
- def __init__(self, line):
- self.line = line
- self.isvalid = True
- self.comment = ''
- self.oname = '' # original name
- self.shortname = self.glname = '' # short and long name
- self.parse_line(line)
-
- def parse_line(self, line):
- # Do initial parsing of the incoming line
- # (which may be multiline, actually)
- pass
-
- def _set_name(self, name):
- # Store original name
- self.oname = name
- # Store plain name
- if name.startswith('GL_'):
- name = name[3:]
- elif name.startswith('gl'):
- name = name[2].lower() + name[3:]
- self.shortname = name
- # Store gl name
- if name.upper() == name:
- name = 'GL_' + name
- else:
- name = 'gl' + name[0].upper() + name[1:]
- self.glname = name
-
-
-
-class ConstantDefinition(Definition):
-
- def parse_line(self, line):
- """ Set cname and value attributes.
- """
- self.value = None
- line = line.split('/*', 1)[0]
- args = getwords(line)[1:]
- self.isvalid = False
- if len(args) == 1:
- pass
- elif len(args) == 2:
- # Set name
- name, val = args
- self.isvalid = bool(name)
- self._set_name(name)
- self._set_value_from_string(val)
- elif '=' in args:
- name, val = args[-3], args[-1]
- self.isvalid = bool(name)
- self._set_name(name)
- self._set_value_from_string(val)
- else:
- print('Dont know what to do with "%s"' % line)
-
- # For when this constant is reused to set another constant
- if self.value is not None:
- CONSTANTS[self.oname] = self.value
-
- def _set_value_from_string(self, val):
- # Set value
- val = val.strip(';')
- if val.startswith('0x'):
- self.value = int(val[2:].rstrip('ul'), 16)
- elif val[0] in '0123456789':
- self.value = int(val)
- elif val.startswith("'"):
- self.value = val
- elif val in CONSTANTS:
- self.value = CONSTANTS[val]
- else:
- print('Warning: Dont know what to do with "%s"' % line)
-
-
-
-class FunctionDefinition(Definition):
-
- SKIPTYPECHARS = 'if' # 'bsifd'
- ALLSKIPCHARS = SKIPTYPECHARS + 'v1234'
-
- def parse_line(self, line):
- """ Set cname, keyname, cargs attributes.
- The list of args always has one entry and the first entry is always
- the output (can be void).
- """
- # Parse components
- beforeBrace, args = line.split('(', 1)
- betweenBraces, _ = args.split(')', 1)
- outs = getwords(beforeBrace)
- prefix, name = outs[:-1], outs[-1]
-
- # Store name
- self._set_name(name)
-
- # Possibly, this function belongs to a collection of similar functions,
- # which we are going to replace with one function in Python.
- self.keyname = self.glname.rstrip('v').rstrip(self.SKIPTYPECHARS).rstrip('1234')
- self.extrachars = self.matchKeyName(self.keyname)
-
- # If this is a list, this instance represents the group
- # If this is True, this instance is in a group (but not the
- # representative)
- self.group = None
-
- # Create list of Argument instances
- self.cargs = [arg.strip() for arg in betweenBraces.split(',')]
- self.args = []
- # Set output arg
- self.args.append(Argument(' '.join(prefix), False))
- # Parse input arguments,
- for arg in self.cargs:
- if arg and arg != 'void':
- self.args.append(Argument(arg))
-
- def matchKeyName(self, keyname):
- if self.glname.startswith(keyname):
- extrachars = self.glname[len(keyname):]
- if all([(c in self.ALLSKIPCHARS) for c in extrachars]):
- return extrachars
-
-
-
-class FunctionGroup(FunctionDefinition):
-
- def parse_line(self, line):
- FunctionDefinition.parse_line(self, line)
- self.group = []
-
-
-
-class Argument:
-
- def __init__(self, argAsString, cinput=True):
- # Parse string
- components = [c for c in argAsString.split(' ') if c]
- if len(components) == 1:
- name = 'unknown_name'
- type = components[0]
- else:
- name = components[-1]
- type = components[-2]
- if 'const' in type:
- type = components[-3] # glShaderSource has "const GLchar* const* string"
- # Store stuff
- self.orig = tuple(components)
- self.name = name.lstrip('*')
- self.isptr = argAsString.count('*') # Number of stars
- self.ctype = type.strip('*') + '*'*self.isptr
- # Status flags
- self.cinput = cinput
-
-
-
-if __name__ == '__main__':
- THISDIR = os.path.abspath(os.path.dirname(__file__))
-
- # Some tests ...
- gl2 = Parser(os.path.join(THISDIR, 'headers', 'gl2.h'))
- import OpenGL.GL
- pygl = set([name for name in dir(OpenGL.GL)])
-
- # Test if all functions are in pyopengl
- for keyfunc in gl2._functionDefs:
- group = keyfunc.group or [keyfunc]
- for f in group:
- if f.glname not in pygl:
- print('Not in pyopengl:', f.glname)
-
- # Test if constant match with these in pyopengl
- for d in gl2._constantDefs:
- v1 = d.value
- try:
- v2 = getattr(OpenGL.GL, d.glname)
- except AttributeError:
- print(d.glname, 'is not in pyopengl')
- else:
- if v1 != v2:
- print(d.glname, 'does not match: %r vs %r' % (v1, int(v2)))
diff --git a/codegen/headers/egl.h b/codegen/headers/egl.h
deleted file mode 100644
index 99ea342..0000000
--- a/codegen/headers/egl.h
+++ /dev/null
@@ -1,329 +0,0 @@
-/* -*- mode: c; tab-width: 8; -*- */
-/* vi: set sw=4 ts=8: */
-/* Reference version of egl.h for EGL 1.4.
- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
- */
-
-/*
-** Copyright (c) 2007-2009 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-#ifndef __egl_h_
-#define __egl_h_
-
-/* All platform-dependent types and macro boilerplate (such as EGLAPI
- * and EGLAPIENTRY) should go in eglplatform.h.
- */
-#include <EGL/eglplatform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* EGL Types */
-/* EGLint is defined in eglplatform.h */
-typedef unsigned int EGLBoolean;
-typedef unsigned int EGLenum;
-typedef void *EGLConfig;
-typedef void *EGLContext;
-typedef void *EGLDisplay;
-typedef void *EGLSurface;
-typedef void *EGLClientBuffer;
-
-/* EGL Versioning */
-#define EGL_VERSION_1_0 1
-#define EGL_VERSION_1_1 1
-#define EGL_VERSION_1_2 1
-#define EGL_VERSION_1_3 1
-#define EGL_VERSION_1_4 1
-
-/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
- * enums are assigned unique values starting at 0x3000.
- */
-
-/* EGL aliases */
-#define EGL_FALSE 0
-#define EGL_TRUE 1
-
-/* Out-of-band handle values */
-#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
-#define EGL_NO_CONTEXT ((EGLContext)0)
-#define EGL_NO_DISPLAY ((EGLDisplay)0)
-#define EGL_NO_SURFACE ((EGLSurface)0)
-
-/* Out-of-band attribute value */
-#define EGL_DONT_CARE ((EGLint)-1)
-
-/* Errors / GetError return values */
-#define EGL_SUCCESS 0x3000
-#define EGL_NOT_INITIALIZED 0x3001
-#define EGL_BAD_ACCESS 0x3002
-#define EGL_BAD_ALLOC 0x3003
-#define EGL_BAD_ATTRIBUTE 0x3004
-#define EGL_BAD_CONFIG 0x3005
-#define EGL_BAD_CONTEXT 0x3006
-#define EGL_BAD_CURRENT_SURFACE 0x3007
-#define EGL_BAD_DISPLAY 0x3008
-#define EGL_BAD_MATCH 0x3009
-#define EGL_BAD_NATIVE_PIXMAP 0x300A
-#define EGL_BAD_NATIVE_WINDOW 0x300B
-#define EGL_BAD_PARAMETER 0x300C
-#define EGL_BAD_SURFACE 0x300D
-#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
-
-/* Reserved 0x300F-0x301F for additional errors */
-
-/* Config attributes */
-#define EGL_BUFFER_SIZE 0x3020
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BLUE_SIZE 0x3022
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_RED_SIZE 0x3024
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_STENCIL_SIZE 0x3026
-#define EGL_CONFIG_CAVEAT 0x3027
-#define EGL_CONFIG_ID 0x3028
-#define EGL_LEVEL 0x3029
-#define EGL_MAX_PBUFFER_HEIGHT 0x302A
-#define EGL_MAX_PBUFFER_PIXELS 0x302B
-#define EGL_MAX_PBUFFER_WIDTH 0x302C
-#define EGL_NATIVE_RENDERABLE 0x302D
-#define EGL_NATIVE_VISUAL_ID 0x302E
-#define EGL_NATIVE_VISUAL_TYPE 0x302F
-#define EGL_SAMPLES 0x3031
-#define EGL_SAMPLE_BUFFERS 0x3032
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_TRANSPARENT_TYPE 0x3034
-#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
-#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
-#define EGL_TRANSPARENT_RED_VALUE 0x3037
-#define EGL_NONE 0x3038 /* Attrib list terminator */
-#define EGL_BIND_TO_TEXTURE_RGB 0x3039
-#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
-#define EGL_MIN_SWAP_INTERVAL 0x303B
-#define EGL_MAX_SWAP_INTERVAL 0x303C
-#define EGL_LUMINANCE_SIZE 0x303D
-#define EGL_ALPHA_MASK_SIZE 0x303E
-#define EGL_COLOR_BUFFER_TYPE 0x303F
-#define EGL_RENDERABLE_TYPE 0x3040
-#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
-#define EGL_CONFORMANT 0x3042
-
-/* Reserved 0x3041-0x304F for additional config attributes */
-
-/* Config attribute values */
-#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
-#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
-#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
-#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
-#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
-
-/* More config attribute values, for EGL_TEXTURE_FORMAT */
-#define EGL_NO_TEXTURE 0x305C
-#define EGL_TEXTURE_RGB 0x305D
-#define EGL_TEXTURE_RGBA 0x305E
-#define EGL_TEXTURE_2D 0x305F
-
-/* Config attribute mask bits */
-#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
-#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
-
-#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
-#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
-#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
-#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
-
-/* QueryString targets */
-#define EGL_VENDOR 0x3053
-#define EGL_VERSION 0x3054
-#define EGL_EXTENSIONS 0x3055
-#define EGL_CLIENT_APIS 0x308D
-
-/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
-#define EGL_HEIGHT 0x3056
-#define EGL_WIDTH 0x3057
-#define EGL_LARGEST_PBUFFER 0x3058
-#define EGL_TEXTURE_FORMAT 0x3080
-#define EGL_TEXTURE_TARGET 0x3081
-#define EGL_MIPMAP_TEXTURE 0x3082
-#define EGL_MIPMAP_LEVEL 0x3083
-#define EGL_RENDER_BUFFER 0x3086
-#define EGL_VG_COLORSPACE 0x3087
-#define EGL_VG_ALPHA_FORMAT 0x3088
-#define EGL_HORIZONTAL_RESOLUTION 0x3090
-#define EGL_VERTICAL_RESOLUTION 0x3091
-#define EGL_PIXEL_ASPECT_RATIO 0x3092
-#define EGL_SWAP_BEHAVIOR 0x3093
-#define EGL_MULTISAMPLE_RESOLVE 0x3099
-
-/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
-#define EGL_BACK_BUFFER 0x3084
-#define EGL_SINGLE_BUFFER 0x3085
-
-/* OpenVG color spaces */
-#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
-#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
-
-/* OpenVG alpha formats */
-#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
-#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
-
-/* Constant scale factor by which fractional display resolutions &
- * aspect ratio are scaled when queried as integer values.
- */
-#define EGL_DISPLAY_SCALING 10000
-
-/* Unknown display resolution/aspect ratio */
-#define EGL_UNKNOWN ((EGLint)-1)
-
-/* Back buffer swap behaviors */
-#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
-#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
-
-/* CreatePbufferFromClientBuffer buffer types */
-#define EGL_OPENVG_IMAGE 0x3096
-
-/* QueryContext targets */
-#define EGL_CONTEXT_CLIENT_TYPE 0x3097
-
-/* CreateContext attributes */
-#define EGL_CONTEXT_CLIENT_VERSION 0x3098
-
-/* Multisample resolution behaviors */
-#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
-#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
-
-/* BindAPI/QueryAPI targets */
-#define EGL_OPENGL_ES_API 0x30A0
-#define EGL_OPENVG_API 0x30A1
-#define EGL_OPENGL_API 0x30A2
-
-/* GetCurrentSurface targets */
-#define EGL_DRAW 0x3059
-#define EGL_READ 0x305A
-
-/* WaitNative engines */
-#define EGL_CORE_NATIVE_ENGINE 0x305B
-
-/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
-#define EGL_COLORSPACE EGL_VG_COLORSPACE
-#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
-#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
-#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
-#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
-#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
-
-/* EGL extensions must request enum blocks from the Khronos
- * API Registrar, who maintains the enumerant registry. Submit
- * a bug in Khronos Bugzilla against task "Registry".
- */
-
-
-
-/* EGL Functions */
-
-EGLAPI EGLint EGLAPIENTRY eglGetError(void);
-
-EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
-EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
-EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
-
-EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
- EGLint config_size, EGLint *num_config);
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
- EGLConfig *configs, EGLint config_size,
- EGLint *num_config);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
- EGLint attribute, EGLint *value);
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
- EGLNativeWindowType win,
- const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
- EGLNativePixmapType pixmap,
- const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
- EGLint attribute, EGLint *value);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
-EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
- EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
- EGLConfig config, const EGLint *attrib_list);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
- EGLint attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
-
-
-EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
- EGLContext share_context,
- const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
-EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
- EGLSurface read, EGLContext ctx);
-
-EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
-EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
- EGLint attribute, EGLint *value);
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
- EGLNativePixmapType target);
-
-/* This is a generic function pointer type, whose name indicates it must
- * be cast to the proper type *and calling convention* before use.
- */
-typedef void (*__eglMustCastToProperFunctionPointerType)(void);
-
-/* Now, define eglGetProcAddress using the generic function ptr. type */
-EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
- eglGetProcAddress(const char *procname);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __egl_h_ */
diff --git a/codegen/headers/gl2.h b/codegen/headers/gl2.h
deleted file mode 100644
index 46bc0a7..0000000
--- a/codegen/headers/gl2.h
+++ /dev/null
@@ -1,620 +0,0 @@
-#ifndef __gl2_h_
-#define __gl2_h_
-
-/* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */
-
-#include <GLES2/gl2platform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-/*-------------------------------------------------------------------------
- * Data type definitions
- *-----------------------------------------------------------------------*/
-
-typedef void GLvoid;
-typedef char GLchar;
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef khronos_int8_t GLbyte;
-typedef short GLshort;
-typedef int GLint;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-typedef unsigned short GLushort;
-typedef unsigned int GLuint;
-typedef khronos_float_t GLfloat;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-
-/* GL types for handling large vertex buffer objects */
-typedef khronos_intptr_t GLintptr;
-typedef khronos_ssize_t GLsizeiptr;
-
-/* OpenGL ES core versions */
-#define GL_ES_VERSION_2_0 1
-
-/* ClearBufferMask */
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-
-/* Boolean */
-#define GL_FALSE 0
-#define GL_TRUE 1
-
-/* BeginMode */
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-
-/* AlphaFunction (not supported in ES20) */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* BlendingFactorDest */
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-
-/* BlendingFactorSrc */
-/* GL_ZERO */
-/* GL_ONE */
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-/* GL_SRC_ALPHA */
-/* GL_ONE_MINUS_SRC_ALPHA */
-/* GL_DST_ALPHA */
-/* GL_ONE_MINUS_DST_ALPHA */
-
-/* BlendEquationSeparate */
-#define GL_FUNC_ADD 0x8006
-#define GL_BLEND_EQUATION 0x8009
-#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-
-/* BlendSubtract */
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-
-/* Separate Blend Functions */
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_BLEND_COLOR 0x8005
-
-/* Buffer Objects */
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STATIC_DRAW 0x88E4
-#define GL_DYNAMIC_DRAW 0x88E8
-
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-
-/* CullFaceMode */
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-
-/* DepthFunction */
-/* GL_NEVER */
-/* GL_LESS */
-/* GL_EQUAL */
-/* GL_LEQUAL */
-/* GL_GREATER */
-/* GL_NOTEQUAL */
-/* GL_GEQUAL */
-/* GL_ALWAYS */
-
-/* EnableCap */
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_CULL_FACE 0x0B44
-#define GL_BLEND 0x0BE2
-#define GL_DITHER 0x0BD0
-#define GL_STENCIL_TEST 0x0B90
-#define GL_DEPTH_TEST 0x0B71
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_COVERAGE 0x80A0
-
-/* ErrorCode */
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_OUT_OF_MEMORY 0x0505
-
-/* FrontFaceDirection */
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-
-/* GetPName */
-#define GL_LINE_WIDTH 0x0B21
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-#define GL_VIEWPORT 0x0BA2
-#define GL_SCISSOR_BOX 0x0C10
-/* GL_SCISSOR_TEST */
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-/* GL_POLYGON_OFFSET_FILL */
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-
-/* GetTextureParameter */
-/* GL_TEXTURE_MAG_FILTER */
-/* GL_TEXTURE_MIN_FILTER */
-/* GL_TEXTURE_WRAP_S */
-/* GL_TEXTURE_WRAP_T */
-
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-
-/* HintMode */
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-
-/* HintTarget */
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-
-/* DataType */
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_INT 0x1404
-#define GL_UNSIGNED_INT 0x1405
-#define GL_FLOAT 0x1406
-#define GL_FIXED 0x140C
-
-/* PixelFormat */
-#define GL_DEPTH_COMPONENT 0x1902
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-
-/* PixelType */
-/* GL_UNSIGNED_BYTE */
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-
-/* Shaders */
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-#define GL_MAX_VERTEX_ATTRIBS 0x8869
-#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
-#define GL_MAX_VARYING_VECTORS 0x8DFC
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
-#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
-#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
-#define GL_SHADER_TYPE 0x8B4F
-#define GL_DELETE_STATUS 0x8B80
-#define GL_LINK_STATUS 0x8B82
-#define GL_VALIDATE_STATUS 0x8B83
-#define GL_ATTACHED_SHADERS 0x8B85
-#define GL_ACTIVE_UNIFORMS 0x8B86
-#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
-#define GL_ACTIVE_ATTRIBUTES 0x8B89
-#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
-#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
-#define GL_CURRENT_PROGRAM 0x8B8D
-
-/* StencilFunction */
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-
-/* StencilOp */
-/* GL_ZERO */
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-#define GL_INVERT 0x150A
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-
-/* StringName */
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-
-/* TextureMagFilter */
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-
-/* TextureMinFilter */
-/* GL_NEAREST */
-/* GL_LINEAR */
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-
-/* TextureParameterName */
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-
-/* TextureTarget */
-/* GL_TEXTURE_2D */
-#define GL_TEXTURE 0x1702
-
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-
-/* TextureUnit */
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-
-/* TextureWrapMode */
-#define GL_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_MIRRORED_REPEAT 0x8370
-
-/* Uniform Types */
-#define GL_FLOAT_VEC2 0x8B50
-#define GL_FLOAT_VEC3 0x8B51
-#define GL_FLOAT_VEC4 0x8B52
-#define GL_INT_VEC2 0x8B53
-#define GL_INT_VEC3 0x8B54
-#define GL_INT_VEC4 0x8B55
-#define GL_BOOL 0x8B56
-#define GL_BOOL_VEC2 0x8B57
-#define GL_BOOL_VEC3 0x8B58
-#define GL_BOOL_VEC4 0x8B59
-#define GL_FLOAT_MAT2 0x8B5A
-#define GL_FLOAT_MAT3 0x8B5B
-#define GL_FLOAT_MAT4 0x8B5C
-#define GL_SAMPLER_2D 0x8B5E
-#define GL_SAMPLER_CUBE 0x8B60
-
-/* Vertex Arrays */
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
-
-/* Read Format */
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-
-/* Shader Source */
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_SHADER_COMPILER 0x8DFA
-
-/* Shader Binary */
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-
-/* Shader Precision-Specified Types */
-#define GL_LOW_FLOAT 0x8DF0
-#define GL_MEDIUM_FLOAT 0x8DF1
-#define GL_HIGH_FLOAT 0x8DF2
-#define GL_LOW_INT 0x8DF3
-#define GL_MEDIUM_INT 0x8DF4
-#define GL_HIGH_INT 0x8DF5
-
-/* Framebuffer Object. */
-#define GL_FRAMEBUFFER 0x8D40
-#define GL_RENDERBUFFER 0x8D41
-
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGB565 0x8D62
-#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_STENCIL_INDEX8 0x8D48
-
-#define GL_RENDERBUFFER_WIDTH 0x8D42
-#define GL_RENDERBUFFER_HEIGHT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
-#define GL_RENDERBUFFER_RED_SIZE 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
-
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
-
-#define GL_COLOR_ATTACHMENT0 0x8CE0
-#define GL_DEPTH_ATTACHMENT 0x8D00
-#define GL_STENCIL_ATTACHMENT 0x8D20
-
-#define GL_NONE 0
-
-#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
-#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
-
-#define GL_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_RENDERBUFFER_BINDING 0x8CA7
-#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
-
-#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
-
-/*-------------------------------------------------------------------------
- * GL core functions.
- *-----------------------------------------------------------------------*/
-
-GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
-GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
-GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
-GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
-GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
-GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
-GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
-GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
-GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
-GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
-GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
-GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
-GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
-GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
-GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
-GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
-GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
-GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
-GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
-GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
-GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
-GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
-GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
-GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
-GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
-GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
-GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
-GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
-GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
-GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
-GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
-GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
-GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
-GL_APICALL void GL_APIENTRY glFinish (void);
-GL_APICALL void GL_APIENTRY glFlush (void);
-GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
-GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
-GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
-GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
-GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
-GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
-GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
-GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
-GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
-GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
-GL_APICALL GLenum GL_APIENTRY glGetError (void);
-GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
-GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
-GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
-GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
-GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
-GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
-GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
-GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
-GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
-GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
-GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
-GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
-GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
-GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
-GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
-GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
-GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
-GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
-GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
-GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
-GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
-GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
-GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
-GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
-GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
-GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
-GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
-GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
-GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
-GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
-GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
-GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
-GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
-GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
-GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
-GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
-GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
-GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
-GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
-GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
-GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
-GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
-GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
-GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gl2_h_ */
\ No newline at end of file
diff --git a/codegen/headers/gl2ext.h b/codegen/headers/gl2ext.h
deleted file mode 100644
index 6aecb15..0000000
--- a/codegen/headers/gl2ext.h
+++ /dev/null
@@ -1,2051 +0,0 @@
-#ifndef __gl2ext_h_
-#define __gl2ext_h_
-
-/* $Revision: 22161 $ on $Date:: 2013-06-25 08:17:27 -0700 #$ */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * This document is licensed under the SGI Free Software B License Version
- * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
- */
-
-#ifndef GL_APIENTRYP
-# define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-/* New types shared by several extensions */
-
-#ifndef __gl3_h_
-/* These are defined with respect to <inttypes.h> in the
- * Apple extension spec, but they are also used by non-APPLE
- * extensions, and in the Khronos header we use the Khronos
- * portable types in khrplatform.h, which must be defined.
- */
-typedef khronos_int64_t GLint64;
-typedef khronos_uint64_t GLuint64;
-typedef struct __GLsync *GLsync;
-#endif
-
-
-/*------------------------------------------------------------------------*
- * OES extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_OES_compressed_ETC1_RGB8_texture */
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_ETC1_RGB8_OES 0x8D64
-#endif
-
-/* GL_OES_compressed_paletted_texture */
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_PALETTE4_RGB8_OES 0x8B90
-#define GL_PALETTE4_RGBA8_OES 0x8B91
-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
-#define GL_PALETTE4_RGBA4_OES 0x8B93
-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
-#define GL_PALETTE8_RGB8_OES 0x8B95
-#define GL_PALETTE8_RGBA8_OES 0x8B96
-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
-#define GL_PALETTE8_RGBA4_OES 0x8B98
-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
-#endif
-
-/* GL_OES_depth24 */
-#ifndef GL_OES_depth24
-#define GL_DEPTH_COMPONENT24_OES 0x81A6
-#endif
-
-/* GL_OES_depth32 */
-#ifndef GL_OES_depth32
-#define GL_DEPTH_COMPONENT32_OES 0x81A7
-#endif
-
-/* GL_OES_depth_texture */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
-typedef void* GLeglImageOES;
-#endif
-
-/* GL_OES_EGL_image_external */
-#ifndef GL_OES_EGL_image_external
-/* GLeglImageOES defined in GL_OES_EGL_image already. */
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#define GL_SAMPLER_EXTERNAL_OES 0x8D66
-#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
-#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
-#endif
-
-/* GL_OES_element_index_uint */
-#ifndef GL_OES_element_index_uint
-#define GL_UNSIGNED_INT 0x1405
-#endif
-
-/* GL_OES_get_program_binary */
-#ifndef GL_OES_get_program_binary
-#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
-#endif
-
-/* GL_OES_mapbuffer */
-#ifndef GL_OES_mapbuffer
-#define GL_WRITE_ONLY_OES 0x88B9
-#define GL_BUFFER_ACCESS_OES 0x88BB
-#define GL_BUFFER_MAPPED_OES 0x88BC
-#define GL_BUFFER_MAP_POINTER_OES 0x88BD
-#endif
-
-/* GL_OES_packed_depth_stencil */
-#ifndef GL_OES_packed_depth_stencil
-#define GL_DEPTH_STENCIL_OES 0x84F9
-#define GL_UNSIGNED_INT_24_8_OES 0x84FA
-#define GL_DEPTH24_STENCIL8_OES 0x88F0
-#endif
-
-/* GL_OES_required_internalformat */
-#ifndef GL_OES_required_internalformat
-#define GL_ALPHA8_OES 0x803C
-#define GL_DEPTH_COMPONENT16_OES 0x81A5
-/* reuse GL_DEPTH_COMPONENT24_OES */
-/* reuse GL_DEPTH24_STENCIL8_OES */
-/* reuse GL_DEPTH_COMPONENT32_OES */
-#define GL_LUMINANCE4_ALPHA4_OES 0x8043
-#define GL_LUMINANCE8_ALPHA8_OES 0x8045
-#define GL_LUMINANCE8_OES 0x8040
-#define GL_RGBA4_OES 0x8056
-#define GL_RGB5_A1_OES 0x8057
-#define GL_RGB565_OES 0x8D62
-/* reuse GL_RGB8_OES */
-/* reuse GL_RGBA8_OES */
-/* reuse GL_RGB10_EXT */
-/* reuse GL_RGB10_A2_EXT */
-#endif
-
-/* GL_OES_rgb8_rgba8 */
-#ifndef GL_OES_rgb8_rgba8
-#define GL_RGB8_OES 0x8051
-#define GL_RGBA8_OES 0x8058
-#endif
-
-/* GL_OES_standard_derivatives */
-#ifndef GL_OES_standard_derivatives
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
-#endif
-
-/* GL_OES_stencil1 */
-#ifndef GL_OES_stencil1
-#define GL_STENCIL_INDEX1_OES 0x8D46
-#endif
-
-/* GL_OES_stencil4 */
-#ifndef GL_OES_stencil4
-#define GL_STENCIL_INDEX4_OES 0x8D47
-#endif
-
-#ifndef GL_OES_surfaceless_context
-#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
-#endif
-
-/* GL_OES_texture_3D */
-#ifndef GL_OES_texture_3D
-#define GL_TEXTURE_WRAP_R_OES 0x8072
-#define GL_TEXTURE_3D_OES 0x806F
-#define GL_TEXTURE_BINDING_3D_OES 0x806A
-#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
-#define GL_SAMPLER_3D_OES 0x8B5F
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
-#endif
-
-/* GL_OES_texture_float */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_texture_float_linear */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_texture_half_float */
-#ifndef GL_OES_texture_half_float
-#define GL_HALF_FLOAT_OES 0x8D61
-#endif
-
-/* GL_OES_texture_half_float_linear */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_texture_npot */
-/* No new tokens introduced by this extension. */
-
-/* GL_OES_vertex_array_object */
-#ifndef GL_OES_vertex_array_object
-#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
-#endif
-
-/* GL_OES_vertex_half_float */
-/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
-
-/* GL_OES_vertex_type_10_10_10_2 */
-#ifndef GL_OES_vertex_type_10_10_10_2
-#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
-#define GL_INT_10_10_10_2_OES 0x8DF7
-#endif
-
-/*------------------------------------------------------------------------*
- * KHR extension tokens
- *------------------------------------------------------------------------*/
-
-#ifndef GL_KHR_debug
-typedef void (GL_APIENTRYP GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
-#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242
-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243
-#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244
-#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245
-#define GL_DEBUG_SOURCE_API_KHR 0x8246
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247
-#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248
-#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249
-#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A
-#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B
-#define GL_DEBUG_TYPE_ERROR_KHR 0x824C
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E
-#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F
-#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250
-#define GL_DEBUG_TYPE_OTHER_KHR 0x8251
-#define GL_DEBUG_TYPE_MARKER_KHR 0x8268
-#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269
-#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A
-#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B
-#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C
-#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D
-#define GL_BUFFER_KHR 0x82E0
-#define GL_SHADER_KHR 0x82E1
-#define GL_PROGRAM_KHR 0x82E2
-#define GL_QUERY_KHR 0x82E3
-/* PROGRAM_PIPELINE only in GL */
-#define GL_SAMPLER_KHR 0x82E6
-/* DISPLAY_LIST only in GL */
-#define GL_MAX_LABEL_LENGTH_KHR 0x82E8
-#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145
-#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147
-#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148
-#define GL_DEBUG_OUTPUT_KHR 0x92E0
-#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002
-#define GL_STACK_OVERFLOW_KHR 0x0503
-#define GL_STACK_UNDERFLOW_KHR 0x0504
-#endif
-
-#ifndef GL_KHR_texture_compression_astc_ldr
-#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
-#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
-#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
-#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
-#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
-#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
-#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
-#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
-#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
-#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
-#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
-#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
-#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
-#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
-#endif
-
-/*------------------------------------------------------------------------*
- * AMD extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_AMD_compressed_3DC_texture */
-#ifndef GL_AMD_compressed_3DC_texture
-#define GL_3DC_X_AMD 0x87F9
-#define GL_3DC_XY_AMD 0x87FA
-#endif
-
-/* GL_AMD_compressed_ATC_texture */
-#ifndef GL_AMD_compressed_ATC_texture
-#define GL_ATC_RGB_AMD 0x8C92
-#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
-#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
-#endif
-
-/* GL_AMD_performance_monitor */
-#ifndef GL_AMD_performance_monitor
-#define GL_COUNTER_TYPE_AMD 0x8BC0
-#define GL_COUNTER_RANGE_AMD 0x8BC1
-#define GL_UNSIGNED_INT64_AMD 0x8BC2
-#define GL_PERCENTAGE_AMD 0x8BC3
-#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
-#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
-#define GL_PERFMON_RESULT_AMD 0x8BC6
-#endif
-
-/* GL_AMD_program_binary_Z400 */
-#ifndef GL_AMD_program_binary_Z400
-#define GL_Z400_BINARY_AMD 0x8740
-#endif
-
-/*------------------------------------------------------------------------*
- * ANGLE extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_ANGLE_depth_texture */
-#ifndef GL_ANGLE_depth_texture
-#define GL_DEPTH_COMPONENT 0x1902
-#define GL_DEPTH_STENCIL_OES 0x84F9
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_UNSIGNED_INT 0x1405
-#define GL_UNSIGNED_INT_24_8_OES 0x84FA
-#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_DEPTH_COMPONENT32_OES 0x81A7
-#define GL_DEPTH24_STENCIL8_OES 0x88F0
-#endif
-
-/* GL_ANGLE_framebuffer_blit */
-#ifndef GL_ANGLE_framebuffer_blit
-#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
-#endif
-
-/* GL_ANGLE_framebuffer_multisample */
-#ifndef GL_ANGLE_framebuffer_multisample
-#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
-#define GL_MAX_SAMPLES_ANGLE 0x8D57
-#endif
-
-/* GL_ANGLE_instanced_arrays */
-#ifndef GL_ANGLE_instanced_arrays
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
-#endif
-
-/* GL_ANGLE_pack_reverse_row_order */
-#ifndef GL_ANGLE_pack_reverse_row_order
-#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
-#endif
-
-/* GL_ANGLE_program_binary */
-#ifndef GL_ANGLE_program_binary
-#define GL_PROGRAM_BINARY_ANGLE 0x93A6
-#endif
-
-/* GL_ANGLE_texture_compression_dxt3 */
-#ifndef GL_ANGLE_texture_compression_dxt3
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
-#endif
-
-/* GL_ANGLE_texture_compression_dxt5 */
-#ifndef GL_ANGLE_texture_compression_dxt5
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
-#endif
-
-/* GL_ANGLE_texture_usage */
-#ifndef GL_ANGLE_texture_usage
-#define GL_TEXTURE_USAGE_ANGLE 0x93A2
-#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
-#endif
-
-/* GL_ANGLE_translated_shader_source */
-#ifndef GL_ANGLE_translated_shader_source
-#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
-#endif
-
-/*------------------------------------------------------------------------*
- * APPLE extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_APPLE_copy_texture_levels */
-/* No new tokens introduced by this extension. */
-
-/* GL_APPLE_framebuffer_multisample */
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
-#define GL_MAX_SAMPLES_APPLE 0x8D57
-#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
-#endif
-
-/* GL_APPLE_rgb_422 */
-#ifndef GL_APPLE_rgb_422
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#endif
-
-/* GL_APPLE_sync */
-#ifndef GL_APPLE_sync
-
-#define GL_SYNC_OBJECT_APPLE 0x8A53
-#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
-#define GL_OBJECT_TYPE_APPLE 0x9112
-#define GL_SYNC_CONDITION_APPLE 0x9113
-#define GL_SYNC_STATUS_APPLE 0x9114
-#define GL_SYNC_FLAGS_APPLE 0x9115
-#define GL_SYNC_FENCE_APPLE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
-#define GL_UNSIGNALED_APPLE 0x9118
-#define GL_SIGNALED_APPLE 0x9119
-#define GL_ALREADY_SIGNALED_APPLE 0x911A
-#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
-#define GL_CONDITION_SATISFIED_APPLE 0x911C
-#define GL_WAIT_FAILED_APPLE 0x911D
-#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
-#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
-#endif
-
-/* GL_APPLE_texture_format_BGRA8888 */
-#ifndef GL_APPLE_texture_format_BGRA8888
-#define GL_BGRA_EXT 0x80E1
-#endif
-
-/* GL_APPLE_texture_max_level */
-#ifndef GL_APPLE_texture_max_level
-#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
-#endif
-
-/*------------------------------------------------------------------------*
- * ARM extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_ARM_mali_program_binary */
-#ifndef GL_ARM_mali_program_binary
-#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61
-#endif
-
-/* GL_ARM_mali_shader_binary */
-#ifndef GL_ARM_mali_shader_binary
-#define GL_MALI_SHADER_BINARY_ARM 0x8F60
-#endif
-
-/* GL_ARM_rgba8 */
-/* No new tokens introduced by this extension. */
-
-/*------------------------------------------------------------------------*
- * EXT extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_EXT_blend_minmax */
-#ifndef GL_EXT_blend_minmax
-#define GL_MIN_EXT 0x8007
-#define GL_MAX_EXT 0x8008
-#endif
-
-/* GL_EXT_color_buffer_half_float */
-#ifndef GL_EXT_color_buffer_half_float
-#define GL_RGBA16F_EXT 0x881A
-#define GL_RGB16F_EXT 0x881B
-#define GL_RG16F_EXT 0x822F
-#define GL_R16F_EXT 0x822D
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
-#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
-#endif
-
-/* GL_EXT_debug_label */
-#ifndef GL_EXT_debug_label
-#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
-#define GL_PROGRAM_OBJECT_EXT 0x8B40
-#define GL_SHADER_OBJECT_EXT 0x8B48
-#define GL_BUFFER_OBJECT_EXT 0x9151
-#define GL_QUERY_OBJECT_EXT 0x9153
-#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
-#endif
-
-/* GL_EXT_debug_marker */
-/* No new tokens introduced by this extension. */
-
-/* GL_EXT_discard_framebuffer */
-#ifndef GL_EXT_discard_framebuffer
-#define GL_COLOR_EXT 0x1800
-#define GL_DEPTH_EXT 0x1801
-#define GL_STENCIL_EXT 0x1802
-#endif
-
-#ifndef GL_EXT_disjoint_timer_query
-#define GL_QUERY_COUNTER_BITS_EXT 0x8864
-#define GL_CURRENT_QUERY_EXT 0x8865
-#define GL_QUERY_RESULT_EXT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
-#define GL_TIME_ELAPSED_EXT 0x88BF
-#define GL_TIMESTAMP_EXT 0x8E28
-#define GL_GPU_DISJOINT_EXT 0x8FBB
-#endif
-
-#ifndef GL_EXT_draw_buffers
-#define GL_EXT_draw_buffers 1
-#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
-#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
-#define GL_DRAW_BUFFER0_EXT 0x8825
-#define GL_DRAW_BUFFER1_EXT 0x8826
-#define GL_DRAW_BUFFER2_EXT 0x8827
-#define GL_DRAW_BUFFER3_EXT 0x8828
-#define GL_DRAW_BUFFER4_EXT 0x8829
-#define GL_DRAW_BUFFER5_EXT 0x882A
-#define GL_DRAW_BUFFER6_EXT 0x882B
-#define GL_DRAW_BUFFER7_EXT 0x882C
-#define GL_DRAW_BUFFER8_EXT 0x882D
-#define GL_DRAW_BUFFER9_EXT 0x882E
-#define GL_DRAW_BUFFER10_EXT 0x882F
-#define GL_DRAW_BUFFER11_EXT 0x8830
-#define GL_DRAW_BUFFER12_EXT 0x8831
-#define GL_DRAW_BUFFER13_EXT 0x8832
-#define GL_DRAW_BUFFER14_EXT 0x8833
-#define GL_DRAW_BUFFER15_EXT 0x8834
-#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
-#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
-#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
-#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
-#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
-#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
-#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
-#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
-#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
-#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
-#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
-#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
-#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
-#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
-#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
-#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
-#endif
-
-/* GL_EXT_map_buffer_range */
-#ifndef GL_EXT_map_buffer_range
-#define GL_MAP_READ_BIT_EXT 0x0001
-#define GL_MAP_WRITE_BIT_EXT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
-#endif
-
-/* GL_EXT_multisampled_render_to_texture */
-#ifndef GL_EXT_multisampled_render_to_texture
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
-/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
-#define GL_MAX_SAMPLES_EXT 0x8D57
-#endif
-
-/* GL_EXT_multiview_draw_buffers */
-#ifndef GL_EXT_multiview_draw_buffers
-#define GL_COLOR_ATTACHMENT_EXT 0x90F0
-#define GL_MULTIVIEW_EXT 0x90F1
-#define GL_DRAW_BUFFER_EXT 0x0C01
-#define GL_READ_BUFFER_EXT 0x0C02
-#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2
-#endif
-
-/* GL_EXT_multi_draw_arrays */
-/* No new tokens introduced by this extension. */
-
-/* GL_EXT_occlusion_query_boolean */
-#ifndef GL_EXT_occlusion_query_boolean
-#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
-#define GL_CURRENT_QUERY_EXT 0x8865
-#define GL_QUERY_RESULT_EXT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
-#endif
-
-/* GL_EXT_read_format_bgra */
-#ifndef GL_EXT_read_format_bgra
-#define GL_BGRA_EXT 0x80E1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
-#endif
-
-/* GL_EXT_robustness */
-#ifndef GL_EXT_robustness
-/* reuse GL_NO_ERROR */
-#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
-#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
-#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
-#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
-#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
-#endif
-
-/* GL_EXT_separate_shader_objects */
-#ifndef GL_EXT_separate_shader_objects
-#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
-#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002
-#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF
-#define GL_PROGRAM_SEPARABLE_EXT 0x8258
-#define GL_ACTIVE_PROGRAM_EXT 0x8259
-#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
-#endif
-
-/* GL_EXT_shader_framebuffer_fetch */
-#ifndef GL_EXT_shader_framebuffer_fetch
-#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
-#endif
-
-/* GL_EXT_shader_texture_lod */
-/* No new tokens introduced by this extension. */
-
-/* GL_EXT_shadow_samplers */
-#ifndef GL_EXT_shadow_samplers
-#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
-#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
-#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
-#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
-#endif
-
-/* GL_EXT_sRGB */
-#ifndef GL_EXT_sRGB
-#define GL_SRGB_EXT 0x8C40
-#define GL_SRGB_ALPHA_EXT 0x8C42
-#define GL_SRGB8_ALPHA8_EXT 0x8C43
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
-#endif
-
-/* GL_EXT_texture_compression_dxt1 */
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#endif
-
-/* GL_EXT_texture_filter_anisotropic */
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-#endif
-
-/* GL_EXT_texture_format_BGRA8888 */
-#ifndef GL_EXT_texture_format_BGRA8888
-#define GL_BGRA_EXT 0x80E1
-#endif
-
-/* GL_EXT_texture_rg */
-#ifndef GL_EXT_texture_rg
-#define GL_RED_EXT 0x1903
-#define GL_RG_EXT 0x8227
-#define GL_R8_EXT 0x8229
-#define GL_RG8_EXT 0x822B
-#endif
-
-/* GL_EXT_texture_storage */
-#ifndef GL_EXT_texture_storage
-#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
-#define GL_ALPHA8_EXT 0x803C
-#define GL_LUMINANCE8_EXT 0x8040
-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
-#define GL_RGBA32F_EXT 0x8814
-#define GL_RGB32F_EXT 0x8815
-#define GL_ALPHA32F_EXT 0x8816
-#define GL_LUMINANCE32F_EXT 0x8818
-#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
-/* reuse GL_RGBA16F_EXT */
-/* reuse GL_RGB16F_EXT */
-#define GL_ALPHA16F_EXT 0x881C
-#define GL_LUMINANCE16F_EXT 0x881E
-#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
-#define GL_RGB10_A2_EXT 0x8059
-#define GL_RGB10_EXT 0x8052
-#define GL_BGRA8_EXT 0x93A1
-#define GL_R8_EXT 0x8229
-#define GL_RG8_EXT 0x822B
-#define GL_R32F_EXT 0x822E
-#define GL_RG32F_EXT 0x8230
-#define GL_R16F_EXT 0x822D
-#define GL_RG16F_EXT 0x822F
-#endif
-
-/* GL_EXT_texture_type_2_10_10_10_REV */
-#ifndef GL_EXT_texture_type_2_10_10_10_REV
-#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
-#endif
-
-/* GL_EXT_unpack_subimage */
-#ifndef GL_EXT_unpack_subimage
-#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
-#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
-#endif
-
-/*------------------------------------------------------------------------*
- * DMP extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_DMP_shader_binary */
-#ifndef GL_DMP_shader_binary
-#define GL_SHADER_BINARY_DMP 0x9250
-#endif
-
-/*------------------------------------------------------------------------*
- * FJ extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_FJ_shader_binary_GCCSO */
-#ifndef GL_FJ_shader_binary_GCCSO
-#define GL_GCCSO_SHADER_BINARY_FJ 0x9260
-#endif
-
-/*------------------------------------------------------------------------*
- * IMG extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_IMG_program_binary */
-#ifndef GL_IMG_program_binary
-#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
-#endif
-
-/* GL_IMG_read_format */
-#ifndef GL_IMG_read_format
-#define GL_BGRA_IMG 0x80E1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
-#endif
-
-/* GL_IMG_shader_binary */
-#ifndef GL_IMG_shader_binary
-#define GL_SGX_BINARY_IMG 0x8C0A
-#endif
-
-/* GL_IMG_texture_compression_pvrtc */
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
-#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
-#endif
-
-/* GL_IMG_texture_compression_pvrtc2 */
-#ifndef GL_IMG_texture_compression_pvrtc2
-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
-#endif
-
-/* GL_IMG_multisampled_render_to_texture */
-#ifndef GL_IMG_multisampled_render_to_texture
-#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
-#define GL_MAX_SAMPLES_IMG 0x9135
-#define GL_TEXTURE_SAMPLES_IMG 0x9136
-#endif
-
-/*------------------------------------------------------------------------*
- * NV extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_NV_coverage_sample */
-#ifndef GL_NV_coverage_sample
-#define GL_COVERAGE_COMPONENT_NV 0x8ED0
-#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
-#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
-#define GL_COVERAGE_BUFFERS_NV 0x8ED3
-#define GL_COVERAGE_SAMPLES_NV 0x8ED4
-#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
-#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
-#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
-#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000
-#endif
-
-/* GL_NV_depth_nonlinear */
-#ifndef GL_NV_depth_nonlinear
-#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
-#endif
-
-/* GL_NV_draw_buffers */
-#ifndef GL_NV_draw_buffers
-#define GL_MAX_DRAW_BUFFERS_NV 0x8824
-#define GL_DRAW_BUFFER0_NV 0x8825
-#define GL_DRAW_BUFFER1_NV 0x8826
-#define GL_DRAW_BUFFER2_NV 0x8827
-#define GL_DRAW_BUFFER3_NV 0x8828
-#define GL_DRAW_BUFFER4_NV 0x8829
-#define GL_DRAW_BUFFER5_NV 0x882A
-#define GL_DRAW_BUFFER6_NV 0x882B
-#define GL_DRAW_BUFFER7_NV 0x882C
-#define GL_DRAW_BUFFER8_NV 0x882D
-#define GL_DRAW_BUFFER9_NV 0x882E
-#define GL_DRAW_BUFFER10_NV 0x882F
-#define GL_DRAW_BUFFER11_NV 0x8830
-#define GL_DRAW_BUFFER12_NV 0x8831
-#define GL_DRAW_BUFFER13_NV 0x8832
-#define GL_DRAW_BUFFER14_NV 0x8833
-#define GL_DRAW_BUFFER15_NV 0x8834
-#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
-#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
-#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
-#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
-#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
-#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
-#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
-#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
-#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
-#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
-#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
-#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
-#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
-#define GL_COLOR_ATTACHMENT13_NV 0x8CED
-#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
-#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
-#endif
-
-/* GL_NV_draw_instanced */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_fbo_color_attachments */
-#ifndef GL_NV_fbo_color_attachments
-#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
-/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */
-#endif
-
-/* GL_NV_fence */
-#ifndef GL_NV_fence
-#define GL_ALL_COMPLETED_NV 0x84F2
-#define GL_FENCE_STATUS_NV 0x84F3
-#define GL_FENCE_CONDITION_NV 0x84F4
-#endif
-
-/* GL_NV_framebuffer_blit */
-#ifndef GL_NV_framebuffer_blit
-#define GL_READ_FRAMEBUFFER_NV 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA
-#endif
-
-/* GL_NV_framebuffer_multisample */
-#ifndef GL_NV_framebuffer_multisample
-#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
-#define GL_MAX_SAMPLES_NV 0x8D57
-#endif
-
-/* GL_NV_generate_mipmap_sRGB */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_instanced_arrays */
-#ifndef GL_NV_instanced_arrays
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
-#endif
-
-/* GL_NV_read_buffer */
-#ifndef GL_NV_read_buffer
-#define GL_READ_BUFFER_NV 0x0C02
-#endif
-
-/* GL_NV_read_buffer_front */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_read_depth */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_read_depth_stencil */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_read_stencil */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_shadow_samplers_array */
-#ifndef GL_NV_shadow_samplers_array
-#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4
-#endif
-
-/* GL_NV_shadow_samplers_cube */
-#ifndef GL_NV_shadow_samplers_cube
-#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5
-#endif
-
-/* GL_NV_sRGB_formats */
-#ifndef GL_NV_sRGB_formats
-#define GL_SLUMINANCE_NV 0x8C46
-#define GL_SLUMINANCE_ALPHA_NV 0x8C44
-#define GL_SRGB8_NV 0x8C41
-#define GL_SLUMINANCE8_NV 0x8C47
-#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45
-#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
-#define GL_ETC1_SRGB8_NV 0x88EE
-#endif
-
-/* GL_NV_texture_border_clamp */
-#ifndef GL_NV_texture_border_clamp
-#define GL_TEXTURE_BORDER_COLOR_NV 0x1004
-#define GL_CLAMP_TO_BORDER_NV 0x812D
-#endif
-
-/* GL_NV_texture_compression_s3tc_update */
-/* No new tokens introduced by this extension. */
-
-/* GL_NV_texture_npot_2D_mipmap */
-/* No new tokens introduced by this extension. */
-
-/*------------------------------------------------------------------------*
- * QCOM extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_QCOM_alpha_test */
-#ifndef GL_QCOM_alpha_test
-#define GL_ALPHA_TEST_QCOM 0x0BC0
-#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
-#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
-#endif
-
-/* GL_QCOM_binning_control */
-#ifndef GL_QCOM_binning_control
-#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0
-#define GL_CPU_OPTIMIZED_QCOM 0x8FB1
-#define GL_GPU_OPTIMIZED_QCOM 0x8FB2
-#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
-#endif
-
-/* GL_QCOM_driver_control */
-/* No new tokens introduced by this extension. */
-
-/* GL_QCOM_extended_get */
-#ifndef GL_QCOM_extended_get
-#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
-#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
-#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
-#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
-#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
-#define GL_TEXTURE_TYPE_QCOM 0x8BD7
-#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
-#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
-#define GL_TEXTURE_TARGET_QCOM 0x8BDA
-#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
-#define GL_STATE_RESTORE 0x8BDC
-#endif
-
-/* GL_QCOM_extended_get2 */
-/* No new tokens introduced by this extension. */
-
-/* GL_QCOM_perfmon_global_mode */
-#ifndef GL_QCOM_perfmon_global_mode
-#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
-#endif
-
-/* GL_QCOM_writeonly_rendering */
-#ifndef GL_QCOM_writeonly_rendering
-#define GL_WRITEONLY_RENDERING_QCOM 0x8823
-#endif
-
-/* GL_QCOM_tiled_rendering */
-#ifndef GL_QCOM_tiled_rendering
-#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
-#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
-#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
-#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
-#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
-#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
-#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
-#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
-#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
-#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
-#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
-#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
-#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
-#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
-#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
-#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
-#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
-#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
-#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
-#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
-#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
-#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
-#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
-#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
-#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
-#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
-#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
-#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
-#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
-#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
-#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
-#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
-#endif
-
-/*------------------------------------------------------------------------*
- * VIV extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_VIV_shader_binary */
-#ifndef GL_VIV_shader_binary
-#define GL_SHADER_BINARY_VIV 0x8FC4
-#endif
-
-/*------------------------------------------------------------------------*
- * End of extension tokens, start of corresponding extension functions
- *------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------*
- * OES extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_OES_compressed_ETC1_RGB8_texture */
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_OES_compressed_ETC1_RGB8_texture 1
-#endif
-
-/* GL_OES_compressed_paletted_texture */
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_OES_compressed_paletted_texture 1
-#endif
-
-/* GL_OES_depth24 */
-#ifndef GL_OES_depth24
-#define GL_OES_depth24 1
-#endif
-
-/* GL_OES_depth32 */
-#ifndef GL_OES_depth32
-#define GL_OES_depth32 1
-#endif
-
-/* GL_OES_depth_texture */
-#ifndef GL_OES_depth_texture
-#define GL_OES_depth_texture 1
-#endif
-
-/* GL_OES_EGL_image */
-#ifndef GL_OES_EGL_image
-#define GL_OES_EGL_image 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
-GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
-#endif
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
-#endif
-
-/* GL_OES_EGL_image_external */
-#ifndef GL_OES_EGL_image_external
-#define GL_OES_EGL_image_external 1
-/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */
-#endif
-
-/* GL_OES_element_index_uint */
-#ifndef GL_OES_element_index_uint
-#define GL_OES_element_index_uint 1
-#endif
-
-/* GL_OES_fbo_render_mipmap */
-#ifndef GL_OES_fbo_render_mipmap
-#define GL_OES_fbo_render_mipmap 1
-#endif
-
-/* GL_OES_fragment_precision_high */
-#ifndef GL_OES_fragment_precision_high
-#define GL_OES_fragment_precision_high 1
-#endif
-
-/* GL_OES_get_program_binary */
-#ifndef GL_OES_get_program_binary
-#define GL_OES_get_program_binary 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
-GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
-typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
-#endif
-
-/* GL_OES_mapbuffer */
-#ifndef GL_OES_mapbuffer
-#define GL_OES_mapbuffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
-GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
-GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params);
-#endif
-typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
-typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params);
-#endif
-
-/* GL_OES_packed_depth_stencil */
-#ifndef GL_OES_packed_depth_stencil
-#define GL_OES_packed_depth_stencil 1
-#endif
-
-/* GL_OES_required_internalformat */
-#ifndef GL_OES_required_internalformat
-#define GL_OES_required_internalformat 1
-#endif
-
-/* GL_OES_rgb8_rgba8 */
-#ifndef GL_OES_rgb8_rgba8
-#define GL_OES_rgb8_rgba8 1
-#endif
-
-/* GL_OES_standard_derivatives */
-#ifndef GL_OES_standard_derivatives
-#define GL_OES_standard_derivatives 1
-#endif
-
-/* GL_OES_stencil1 */
-#ifndef GL_OES_stencil1
-#define GL_OES_stencil1 1
-#endif
-
-/* GL_OES_stencil4 */
-#ifndef GL_OES_stencil4
-#define GL_OES_stencil4 1
-#endif
-
-#ifndef GL_OES_surfaceless_context
-#define GL_OES_surfaceless_context 1
-#endif
-
-/* GL_OES_texture_3D */
-#ifndef GL_OES_texture_3D
-#define GL_OES_texture_3D 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
-GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-#endif
-typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
-typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
-typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-#endif
-
-/* GL_OES_texture_float */
-#ifndef GL_OES_texture_float
-#define GL_OES_texture_float 1
-#endif
-
-/* GL_OES_texture_float_linear */
-#ifndef GL_OES_texture_float_linear
-#define GL_OES_texture_float_linear 1
-#endif
-
-/* GL_OES_texture_half_float */
-#ifndef GL_OES_texture_half_float
-#define GL_OES_texture_half_float 1
-#endif
-
-/* GL_OES_texture_half_float_linear */
-#ifndef GL_OES_texture_half_float_linear
-#define GL_OES_texture_half_float_linear 1
-#endif
-
-/* GL_OES_texture_npot */
-#ifndef GL_OES_texture_npot
-#define GL_OES_texture_npot 1
-#endif
-
-/* GL_OES_vertex_array_object */
-#ifndef GL_OES_vertex_array_object
-#define GL_OES_vertex_array_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
-GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
-GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
-GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
-#endif
-typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
-typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
-typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
-typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
-#endif
-
-/* GL_OES_vertex_half_float */
-#ifndef GL_OES_vertex_half_float
-#define GL_OES_vertex_half_float 1
-#endif
-
-/* GL_OES_vertex_type_10_10_10_2 */
-#ifndef GL_OES_vertex_type_10_10_10_2
-#define GL_OES_vertex_type_10_10_10_2 1
-#endif
-
-/*------------------------------------------------------------------------*
- * KHR extension functions
- *------------------------------------------------------------------------*/
-
-#ifndef GL_KHR_debug
-#define GL_KHR_debug 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam);
-GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void);
-GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params);
-#endif
-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam);
-typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void);
-typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
-#endif
-
-#ifndef GL_KHR_texture_compression_astc_ldr
-#define GL_KHR_texture_compression_astc_ldr 1
-#endif
-
-
-/*------------------------------------------------------------------------*
- * AMD extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_AMD_compressed_3DC_texture */
-#ifndef GL_AMD_compressed_3DC_texture
-#define GL_AMD_compressed_3DC_texture 1
-#endif
-
-/* GL_AMD_compressed_ATC_texture */
-#ifndef GL_AMD_compressed_ATC_texture
-#define GL_AMD_compressed_ATC_texture 1
-#endif
-
-/* AMD_performance_monitor */
-#ifndef GL_AMD_performance_monitor
-#define GL_AMD_performance_monitor 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
-GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
-GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
-GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
-typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
-typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#endif
-
-/* GL_AMD_program_binary_Z400 */
-#ifndef GL_AMD_program_binary_Z400
-#define GL_AMD_program_binary_Z400 1
-#endif
-
-/*------------------------------------------------------------------------*
- * ANGLE extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_ANGLE_depth_texture */
-#ifndef GL_ANGLE_depth_texture
-#define GL_ANGLE_depth_texture 1
-#endif
-
-/* GL_ANGLE_framebuffer_blit */
-#ifndef GL_ANGLE_framebuffer_blit
-#define GL_ANGLE_framebuffer_blit 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-
-/* GL_ANGLE_framebuffer_multisample */
-#ifndef GL_ANGLE_framebuffer_multisample
-#define GL_ANGLE_framebuffer_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-
-#ifndef GL_ANGLE_instanced_arrays
-#define GL_ANGLE_instanced_arrays 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
-#endif
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
-#endif
-
-/* GL_ANGLE_pack_reverse_row_order */
-#ifndef GL_ANGLE_pack_reverse_row_order
-#define GL_ANGLE_pack_reverse_row_order 1
-#endif
-
-/* GL_ANGLE_program_binary */
-#ifndef GL_ANGLE_program_binary
-#define GL_ANGLE_program_binary 1
-#endif
-
-/* GL_ANGLE_texture_compression_dxt3 */
-#ifndef GL_ANGLE_texture_compression_dxt3
-#define GL_ANGLE_texture_compression_dxt3 1
-#endif
-
-/* GL_ANGLE_texture_compression_dxt5 */
-#ifndef GL_ANGLE_texture_compression_dxt5
-#define GL_ANGLE_texture_compression_dxt5 1
-#endif
-
-/* GL_ANGLE_texture_usage */
-#ifndef GL_ANGLE_texture_usage
-#define GL_ANGLE_texture_usage 1
-#endif
-
-#ifndef GL_ANGLE_translated_shader_source
-#define GL_ANGLE_translated_shader_source 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
-#endif
-
-/*------------------------------------------------------------------------*
- * APPLE extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_APPLE_copy_texture_levels */
-#ifndef GL_APPLE_copy_texture_levels
-#define GL_APPLE_copy_texture_levels 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
-#endif
-typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
-#endif
-
-/* GL_APPLE_framebuffer_multisample */
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_APPLE_framebuffer_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
-#endif
-
-/* GL_APPLE_rgb_422 */
-#ifndef GL_APPLE_rgb_422
-#define GL_APPLE_rgb_422 1
-#endif
-
-/* GL_APPLE_sync */
-#ifndef GL_APPLE_sync
-#define GL_APPLE_sync 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
-GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
-GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
-GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
-GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-#endif
-typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
-typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
-typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
-typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
-typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-#endif
-
-/* GL_APPLE_texture_format_BGRA8888 */
-#ifndef GL_APPLE_texture_format_BGRA8888
-#define GL_APPLE_texture_format_BGRA8888 1
-#endif
-
-/* GL_APPLE_texture_max_level */
-#ifndef GL_APPLE_texture_max_level
-#define GL_APPLE_texture_max_level 1
-#endif
-
-/*------------------------------------------------------------------------*
- * ARM extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_ARM_mali_program_binary */
-#ifndef GL_ARM_mali_program_binary
-#define GL_ARM_mali_program_binary 1
-#endif
-
-/* GL_ARM_mali_shader_binary */
-#ifndef GL_ARM_mali_shader_binary
-#define GL_ARM_mali_shader_binary 1
-#endif
-
-/* GL_ARM_rgba8 */
-#ifndef GL_ARM_rgba8
-#define GL_ARM_rgba8 1
-#endif
-
-/*------------------------------------------------------------------------*
- * EXT extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_EXT_blend_minmax */
-#ifndef GL_EXT_blend_minmax
-#define GL_EXT_blend_minmax 1
-#endif
-
-/* GL_EXT_color_buffer_half_float */
-#ifndef GL_EXT_color_buffer_half_float
-#define GL_EXT_color_buffer_half_float 1
-#endif
-
-/* GL_EXT_debug_label */
-#ifndef GL_EXT_debug_label
-#define GL_EXT_debug_label 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-
-/* GL_EXT_debug_marker */
-#ifndef GL_EXT_debug_marker
-#define GL_EXT_debug_marker 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
-GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
-GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
-#endif
-typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
-#endif
-
-/* GL_EXT_discard_framebuffer */
-#ifndef GL_EXT_discard_framebuffer
-#define GL_EXT_discard_framebuffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#endif
-typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#endif
-
-#ifndef GL_EXT_disjoint_timer_query
-#define GL_EXT_disjoint_timer_query 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
-GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
-GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
-GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target);
-GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
-#endif
-typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
-typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
-typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
-typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
-#endif /* GL_EXT_disjoint_timer_query */
-
-#ifndef GL_EXT_draw_buffers
-#define GL_EXT_draw_buffers 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
-#endif
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
-#endif /* GL_EXT_draw_buffers */
-
-/* GL_EXT_map_buffer_range */
-#ifndef GL_EXT_map_buffer_range
-#define GL_EXT_map_buffer_range 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
-#endif
-typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
-#endif
-
-/* GL_EXT_multisampled_render_to_texture */
-#ifndef GL_EXT_multisampled_render_to_texture
-#define GL_EXT_multisampled_render_to_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
-#endif
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-
-/* GL_EXT_multiview_draw_buffers */
-#ifndef GL_EXT_multiview_draw_buffers
-#define GL_EXT_multiview_draw_buffers 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
-GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
-GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
-#endif
-typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
-typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
-#endif
-
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, const GLint *, const GLsizei *, GLsizei);
-GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
-#endif
-
-/* GL_EXT_occlusion_query_boolean */
-#ifndef GL_EXT_occlusion_query_boolean
-#define GL_EXT_occlusion_query_boolean 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
-GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
-GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
-GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
-#endif
-typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
-typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
-typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
-typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
-#endif
-
-/* GL_EXT_read_format_bgra */
-#ifndef GL_EXT_read_format_bgra
-#define GL_EXT_read_format_bgra 1
-#endif
-
-/* GL_EXT_robustness */
-#ifndef GL_EXT_robustness
-#define GL_EXT_robustness 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
-GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params);
-GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif
-typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
-typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif
-
-/* GL_EXT_separate_shader_objects */
-#ifndef GL_EXT_separate_shader_objects
-#define GL_EXT_separate_shader_objects 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
-GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
-GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
-GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
-GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
-GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x);
-GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y);
-GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z);
-GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
-GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x);
-GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-#endif
-typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
-typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
-typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
-typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
-typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
-typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-#endif
-
-/* GL_EXT_shader_framebuffer_fetch */
-#ifndef GL_EXT_shader_framebuffer_fetch
-#define GL_EXT_shader_framebuffer_fetch 1
-#endif
-
-/* GL_EXT_shader_texture_lod */
-#ifndef GL_EXT_shader_texture_lod
-#define GL_EXT_shader_texture_lod 1
-#endif
-
-/* GL_EXT_shadow_samplers */
-#ifndef GL_EXT_shadow_samplers
-#define GL_EXT_shadow_samplers 1
-#endif
-
-/* GL_EXT_sRGB */
-#ifndef GL_EXT_sRGB
-#define GL_EXT_sRGB 1
-#endif
-
-/* GL_EXT_texture_compression_dxt1 */
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_EXT_texture_compression_dxt1 1
-#endif
-
-/* GL_EXT_texture_filter_anisotropic */
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_EXT_texture_filter_anisotropic 1
-#endif
-
-/* GL_EXT_texture_format_BGRA8888 */
-#ifndef GL_EXT_texture_format_BGRA8888
-#define GL_EXT_texture_format_BGRA8888 1
-#endif
-
-/* GL_EXT_texture_rg */
-#ifndef GL_EXT_texture_rg
-#define GL_EXT_texture_rg 1
-#endif
-
-/* GL_EXT_texture_storage */
-#ifndef GL_EXT_texture_storage
-#define GL_EXT_texture_storage 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-
-/* GL_EXT_texture_type_2_10_10_10_REV */
-#ifndef GL_EXT_texture_type_2_10_10_10_REV
-#define GL_EXT_texture_type_2_10_10_10_REV 1
-#endif
-
-/* GL_EXT_unpack_subimage */
-#ifndef GL_EXT_unpack_subimage
-#define GL_EXT_unpack_subimage 1
-#endif
-
-/*------------------------------------------------------------------------*
- * DMP extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_DMP_shader_binary */
-#ifndef GL_DMP_shader_binary
-#define GL_DMP_shader_binary 1
-#endif
-
-/*------------------------------------------------------------------------*
- * FJ extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_FJ_shader_binary_GCCSO */
-#ifndef GL_FJ_shader_binary_GCCSO
-#define GL_FJ_shader_binary_GCCSO 1
-#endif
-
-/*------------------------------------------------------------------------*
- * IMG extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_IMG_program_binary */
-#ifndef GL_IMG_program_binary
-#define GL_IMG_program_binary 1
-#endif
-
-/* GL_IMG_read_format */
-#ifndef GL_IMG_read_format
-#define GL_IMG_read_format 1
-#endif
-
-/* GL_IMG_shader_binary */
-#ifndef GL_IMG_shader_binary
-#define GL_IMG_shader_binary 1
-#endif
-
-/* GL_IMG_texture_compression_pvrtc */
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_IMG_texture_compression_pvrtc 1
-#endif
-
-/* GL_IMG_texture_compression_pvrtc2 */
-#ifndef GL_IMG_texture_compression_pvrtc2
-#define GL_IMG_texture_compression_pvrtc2 1
-#endif
-
-/* GL_IMG_multisampled_render_to_texture */
-#ifndef GL_IMG_multisampled_render_to_texture
-#define GL_IMG_multisampled_render_to_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
-#endif
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-
-/*------------------------------------------------------------------------*
- * NV extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_NV_coverage_sample */
-#ifndef GL_NV_coverage_sample
-#define GL_NV_coverage_sample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
-GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
-#endif
-typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
-typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
-#endif
-
-/* GL_NV_depth_nonlinear */
-#ifndef GL_NV_depth_nonlinear
-#define GL_NV_depth_nonlinear 1
-#endif
-
-/* GL_NV_draw_buffers */
-#ifndef GL_NV_draw_buffers
-#define GL_NV_draw_buffers 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
-#endif
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
-#endif
-
-/* GL_NV_draw_instanced */
-#ifndef GL_NV_draw_instanced
-#define GL_NV_draw_instanced 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
-#endif
-typedef void (GL_APIENTRYP PFNDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
-#endif
-
-/* GL_NV_fbo_color_attachments */
-#ifndef GL_NV_fbo_color_attachments
-#define GL_NV_fbo_color_attachments 1
-#endif
-
-/* GL_NV_fence */
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *);
-GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *);
-GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint);
-GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint);
-GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *);
-GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint);
-GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum);
-#endif
-typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
-typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
-typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
-typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
-#endif
-
-/* GL_NV_framebuffer_blit */
-#ifndef GL_NV_framebuffer_blit
-#define GL_NV_framebuffer_blit 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlitFramebufferNV (int srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-typedef void (GL_APIENTRYP PFNBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-
-/* GL_NV_framebuffer_multisample */
-#ifndef GL_NV_framebuffer_multisample
-#define GL_NV_framebuffer_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-typedef void (GL_APIENTRYP PFNRENDERBUFFERSTORAGEMULTISAMPLENVPROC) ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-
-/* GL_NV_generate_mipmap_sRGB */
-#ifndef GL_NV_generate_mipmap_sRGB
-#define GL_NV_generate_mipmap_sRGB 1
-#endif
-
-/* GL_NV_instanced_arrays */
-#ifndef GL_NV_instanced_arrays
-#define GL_NV_instanced_arrays 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
-#endif
-typedef void (GL_APIENTRYP PFNVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
-#endif
-
-/* GL_NV_read_buffer */
-#ifndef GL_NV_read_buffer
-#define GL_NV_read_buffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
-#endif
-typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
-#endif
-
-/* GL_NV_read_buffer_front */
-#ifndef GL_NV_read_buffer_front
-#define GL_NV_read_buffer_front 1
-#endif
-
-/* GL_NV_read_depth */
-#ifndef GL_NV_read_depth
-#define GL_NV_read_depth 1
-#endif
-
-/* GL_NV_read_depth_stencil */
-#ifndef GL_NV_read_depth_stencil
-#define GL_NV_read_depth_stencil 1
-#endif
-
-/* GL_NV_read_stencil */
-#ifndef GL_NV_read_stencil
-#define GL_NV_read_stencil 1
-#endif
-
-/* GL_NV_shadow_samplers_array */
-#ifndef GL_NV_shadow_samplers_array
-#define GL_NV_shadow_samplers_array 1
-#endif
-
-/* GL_NV_shadow_samplers_cube */
-#ifndef GL_NV_shadow_samplers_cube
-#define GL_NV_shadow_samplers_cube 1
-#endif
-
-/* GL_NV_sRGB_formats */
-#ifndef GL_NV_sRGB_formats
-#define GL_NV_sRGB_formats 1
-#endif
-
-/* GL_NV_texture_border_clamp */
-#ifndef GL_NV_texture_border_clamp
-#define GL_NV_texture_border_clamp 1
-#endif
-
-/* GL_NV_texture_compression_s3tc_update */
-#ifndef GL_NV_texture_compression_s3tc_update
-#define GL_NV_texture_compression_s3tc_update 1
-#endif
-
-/* GL_NV_texture_npot_2D_mipmap */
-#ifndef GL_NV_texture_npot_2D_mipmap
-#define GL_NV_texture_npot_2D_mipmap 1
-#endif
-
-/*------------------------------------------------------------------------*
- * QCOM extension functions
- *------------------------------------------------------------------------*/
-
-/* GL_QCOM_alpha_test */
-#ifndef GL_QCOM_alpha_test
-#define GL_QCOM_alpha_test 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
-#endif
-typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
-#endif
-
-/* GL_QCOM_binning_control */
-#ifndef GL_QCOM_binning_control
-#define GL_QCOM_binning_control 1
-#endif
-
-/* GL_QCOM_driver_control */
-#ifndef GL_QCOM_driver_control
-#define GL_QCOM_driver_control 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
-GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
-GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
-#endif
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-#endif
-
-/* GL_QCOM_extended_get */
-#ifndef GL_QCOM_extended_get
-#define GL_QCOM_extended_get 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
-GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
-GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params);
-#endif
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params);
-#endif
-
-/* GL_QCOM_extended_get2 */
-#ifndef GL_QCOM_extended_get2
-#define GL_QCOM_extended_get2 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
-GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#endif
-typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#endif
-
-/* GL_QCOM_perfmon_global_mode */
-#ifndef GL_QCOM_perfmon_global_mode
-#define GL_QCOM_perfmon_global_mode 1
-#endif
-
-/* GL_QCOM_writeonly_rendering */
-#ifndef GL_QCOM_writeonly_rendering
-#define GL_QCOM_writeonly_rendering 1
-#endif
-
-/* GL_QCOM_tiled_rendering */
-#ifndef GL_QCOM_tiled_rendering
-#define GL_QCOM_tiled_rendering 1
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
-#endif
-typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
-#endif
-
-/*------------------------------------------------------------------------*
- * VIV extension tokens
- *------------------------------------------------------------------------*/
-
-/* GL_VIV_shader_binary */
-#ifndef GL_VIV_shader_binary
-#define GL_VIV_shader_binary 1
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __gl2ext_h_ */
\ No newline at end of file
diff --git a/codegen/headers/webgl.idl b/codegen/headers/webgl.idl
deleted file mode 100644
index dee0a14..0000000
--- a/codegen/headers/webgl.idl
+++ /dev/null
@@ -1,743 +0,0 @@
-// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile
-//
-// WebGL IDL definitions scraped from the Khronos specification:
-// https://www.khronos.org/registry/webgl/specs/latest/
-//
-// This IDL depends on the typed array specification defined at:
-// https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl
-
-typedef unsigned long GLenum;
-typedef boolean GLboolean;
-typedef unsigned long GLbitfield;
-typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */
-typedef short GLshort;
-typedef long GLint;
-typedef long GLsizei;
-typedef long long GLintptr;
-typedef long long GLsizeiptr;
-// Ideally the typedef below would use 'unsigned byte', but that doesn't currently exist in Web IDL.
-typedef octet GLubyte; /* 'octet' should be an unsigned 8 bit type. */
-typedef unsigned short GLushort;
-typedef unsigned long GLuint;
-typedef unrestricted float GLfloat;
-typedef unrestricted float GLclampf;
-
-
-dictionary WebGLContextAttributes {
- GLboolean alpha = true;
- GLboolean depth = true;
- GLboolean stencil = false;
- GLboolean antialias = true;
- GLboolean premultipliedAlpha = true;
- GLboolean preserveDrawingBuffer = false;
- GLboolean preferLowPowerToHighPerformance = false;
- GLboolean failIfMajorPerformanceCaveat = false;
-};
-
-interface WebGLObject {
-};
-
-interface WebGLBuffer : WebGLObject {
-};
-
-interface WebGLFramebuffer : WebGLObject {
-};
-
-interface WebGLProgram : WebGLObject {
-};
-
-interface WebGLRenderbuffer : WebGLObject {
-};
-
-interface WebGLShader : WebGLObject {
-};
-
-interface WebGLTexture : WebGLObject {
-};
-
-interface WebGLUniformLocation {
-};
-
-interface WebGLActiveInfo {
- readonly attribute GLint size;
- readonly attribute GLenum type;
- readonly attribute DOMString name;
-};
-
-interface WebGLShaderPrecisionFormat {
- readonly attribute GLint rangeMin;
- readonly attribute GLint rangeMax;
- readonly attribute GLint precision;
-};
-
-[NoInterfaceObject]
-interface WebGLRenderingContextBase
-{
-
- /* ClearBufferMask */
- const GLenum DEPTH_BUFFER_BIT = 0x00000100;
- const GLenum STENCIL_BUFFER_BIT = 0x00000400;
- const GLenum COLOR_BUFFER_BIT = 0x00004000;
-
- /* BeginMode */
- const GLenum POINTS = 0x0000;
- const GLenum LINES = 0x0001;
- const GLenum LINE_LOOP = 0x0002;
- const GLenum LINE_STRIP = 0x0003;
- const GLenum TRIANGLES = 0x0004;
- const GLenum TRIANGLE_STRIP = 0x0005;
- const GLenum TRIANGLE_FAN = 0x0006;
-
- /* AlphaFunction (not supported in ES20) */
- /* NEVER */
- /* LESS */
- /* EQUAL */
- /* LEQUAL */
- /* GREATER */
- /* NOTEQUAL */
- /* GEQUAL */
- /* ALWAYS */
-
- /* BlendingFactorDest */
- const GLenum ZERO = 0;
- const GLenum ONE = 1;
- const GLenum SRC_COLOR = 0x0300;
- const GLenum ONE_MINUS_SRC_COLOR = 0x0301;
- const GLenum SRC_ALPHA = 0x0302;
- const GLenum ONE_MINUS_SRC_ALPHA = 0x0303;
- const GLenum DST_ALPHA = 0x0304;
- const GLenum ONE_MINUS_DST_ALPHA = 0x0305;
-
- /* BlendingFactorSrc */
- /* ZERO */
- /* ONE */
- const GLenum DST_COLOR = 0x0306;
- const GLenum ONE_MINUS_DST_COLOR = 0x0307;
- const GLenum SRC_ALPHA_SATURATE = 0x0308;
- /* SRC_ALPHA */
- /* ONE_MINUS_SRC_ALPHA */
- /* DST_ALPHA */
- /* ONE_MINUS_DST_ALPHA */
-
- /* BlendEquationSeparate */
- const GLenum FUNC_ADD = 0x8006;
- const GLenum BLEND_EQUATION = 0x8009;
- const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */
- const GLenum BLEND_EQUATION_ALPHA = 0x883D;
-
- /* BlendSubtract */
- const GLenum FUNC_SUBTRACT = 0x800A;
- const GLenum FUNC_REVERSE_SUBTRACT = 0x800B;
-
- /* Separate Blend Functions */
- const GLenum BLEND_DST_RGB = 0x80C8;
- const GLenum BLEND_SRC_RGB = 0x80C9;
- const GLenum BLEND_DST_ALPHA = 0x80CA;
- const GLenum BLEND_SRC_ALPHA = 0x80CB;
- const GLenum CONSTANT_COLOR = 0x8001;
- const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002;
- const GLenum CONSTANT_ALPHA = 0x8003;
- const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004;
- const GLenum BLEND_COLOR = 0x8005;
-
- /* Buffer Objects */
- const GLenum ARRAY_BUFFER = 0x8892;
- const GLenum ELEMENT_ARRAY_BUFFER = 0x8893;
- const GLenum ARRAY_BUFFER_BINDING = 0x8894;
- const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
-
- const GLenum STREAM_DRAW = 0x88E0;
- const GLenum STATIC_DRAW = 0x88E4;
- const GLenum DYNAMIC_DRAW = 0x88E8;
-
- const GLenum BUFFER_SIZE = 0x8764;
- const GLenum BUFFER_USAGE = 0x8765;
-
- const GLenum CURRENT_VERTEX_ATTRIB = 0x8626;
-
- /* CullFaceMode */
- const GLenum FRONT = 0x0404;
- const GLenum BACK = 0x0405;
- const GLenum FRONT_AND_BACK = 0x0408;
-
- /* DepthFunction */
- /* NEVER */
- /* LESS */
- /* EQUAL */
- /* LEQUAL */
- /* GREATER */
- /* NOTEQUAL */
- /* GEQUAL */
- /* ALWAYS */
-
- /* EnableCap */
- /* TEXTURE_2D */
- const GLenum CULL_FACE = 0x0B44;
- const GLenum BLEND = 0x0BE2;
- const GLenum DITHER = 0x0BD0;
- const GLenum STENCIL_TEST = 0x0B90;
- const GLenum DEPTH_TEST = 0x0B71;
- const GLenum SCISSOR_TEST = 0x0C11;
- const GLenum POLYGON_OFFSET_FILL = 0x8037;
- const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
- const GLenum SAMPLE_COVERAGE = 0x80A0;
-
- /* ErrorCode */
- const GLenum NO_ERROR = 0;
- const GLenum INVALID_ENUM = 0x0500;
- const GLenum INVALID_VALUE = 0x0501;
- const GLenum INVALID_OPERATION = 0x0502;
- const GLenum OUT_OF_MEMORY = 0x0505;
-
- /* FrontFaceDirection */
- const GLenum CW = 0x0900;
- const GLenum CCW = 0x0901;
-
- /* GetPName */
- const GLenum LINE_WIDTH = 0x0B21;
- const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D;
- const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E;
- const GLenum CULL_FACE_MODE = 0x0B45;
- const GLenum FRONT_FACE = 0x0B46;
- const GLenum DEPTH_RANGE = 0x0B70;
- const GLenum DEPTH_WRITEMASK = 0x0B72;
- const GLenum DEPTH_CLEAR_VALUE = 0x0B73;
- const GLenum DEPTH_FUNC = 0x0B74;
- const GLenum STENCIL_CLEAR_VALUE = 0x0B91;
- const GLenum STENCIL_FUNC = 0x0B92;
- const GLenum STENCIL_FAIL = 0x0B94;
- const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95;
- const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96;
- const GLenum STENCIL_REF = 0x0B97;
- const GLenum STENCIL_VALUE_MASK = 0x0B93;
- const GLenum STENCIL_WRITEMASK = 0x0B98;
- const GLenum STENCIL_BACK_FUNC = 0x8800;
- const GLenum STENCIL_BACK_FAIL = 0x8801;
- const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
- const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
- const GLenum STENCIL_BACK_REF = 0x8CA3;
- const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4;
- const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5;
- const GLenum VIEWPORT = 0x0BA2;
- const GLenum SCISSOR_BOX = 0x0C10;
- /* SCISSOR_TEST */
- const GLenum COLOR_CLEAR_VALUE = 0x0C22;
- const GLenum COLOR_WRITEMASK = 0x0C23;
- const GLenum UNPACK_ALIGNMENT = 0x0CF5;
- const GLenum PACK_ALIGNMENT = 0x0D05;
- const GLenum MAX_TEXTURE_SIZE = 0x0D33;
- const GLenum MAX_VIEWPORT_DIMS = 0x0D3A;
- const GLenum SUBPIXEL_BITS = 0x0D50;
- const GLenum RED_BITS = 0x0D52;
- const GLenum GREEN_BITS = 0x0D53;
- const GLenum BLUE_BITS = 0x0D54;
- const GLenum ALPHA_BITS = 0x0D55;
- const GLenum DEPTH_BITS = 0x0D56;
- const GLenum STENCIL_BITS = 0x0D57;
- const GLenum POLYGON_OFFSET_UNITS = 0x2A00;
- /* POLYGON_OFFSET_FILL */
- const GLenum POLYGON_OFFSET_FACTOR = 0x8038;
- const GLenum TEXTURE_BINDING_2D = 0x8069;
- const GLenum SAMPLE_BUFFERS = 0x80A8;
- const GLenum SAMPLES = 0x80A9;
- const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA;
- const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB;
-
- /* GetTextureParameter */
- /* TEXTURE_MAG_FILTER */
- /* TEXTURE_MIN_FILTER */
- /* TEXTURE_WRAP_S */
- /* TEXTURE_WRAP_T */
-
- const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3;
-
- /* HintMode */
- const GLenum DONT_CARE = 0x1100;
- const GLenum FASTEST = 0x1101;
- const GLenum NICEST = 0x1102;
-
- /* HintTarget */
- const GLenum GENERATE_MIPMAP_HINT = 0x8192;
-
- /* DataType */
- const GLenum BYTE = 0x1400;
- const GLenum UNSIGNED_BYTE = 0x1401;
- const GLenum SHORT = 0x1402;
- const GLenum UNSIGNED_SHORT = 0x1403;
- const GLenum INT = 0x1404;
- const GLenum UNSIGNED_INT = 0x1405;
- const GLenum FLOAT = 0x1406;
-
- /* PixelFormat */
- const GLenum DEPTH_COMPONENT = 0x1902;
- const GLenum ALPHA = 0x1906;
- const GLenum RGB = 0x1907;
- const GLenum RGBA = 0x1908;
- const GLenum LUMINANCE = 0x1909;
- const GLenum LUMINANCE_ALPHA = 0x190A;
-
- /* PixelType */
- /* UNSIGNED_BYTE */
- const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033;
- const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034;
- const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363;
-
- /* Shaders */
- const GLenum FRAGMENT_SHADER = 0x8B30;
- const GLenum VERTEX_SHADER = 0x8B31;
- const GLenum MAX_VERTEX_ATTRIBS = 0x8869;
- const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
- const GLenum MAX_VARYING_VECTORS = 0x8DFC;
- const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
- const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
- const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872;
- const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
- const GLenum SHADER_TYPE = 0x8B4F;
- const GLenum DELETE_STATUS = 0x8B80;
- const GLenum LINK_STATUS = 0x8B82;
- const GLenum VALIDATE_STATUS = 0x8B83;
- const GLenum ATTACHED_SHADERS = 0x8B85;
- const GLenum ACTIVE_UNIFORMS = 0x8B86;
- const GLenum ACTIVE_ATTRIBUTES = 0x8B89;
- const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C;
- const GLenum CURRENT_PROGRAM = 0x8B8D;
-
- /* StencilFunction */
- const GLenum NEVER = 0x0200;
- const GLenum LESS = 0x0201;
- const GLenum EQUAL = 0x0202;
- const GLenum LEQUAL = 0x0203;
- const GLenum GREATER = 0x0204;
- const GLenum NOTEQUAL = 0x0205;
- const GLenum GEQUAL = 0x0206;
- const GLenum ALWAYS = 0x0207;
-
- /* StencilOp */
- /* ZERO */
- const GLenum KEEP = 0x1E00;
- const GLenum REPLACE = 0x1E01;
- const GLenum INCR = 0x1E02;
- const GLenum DECR = 0x1E03;
- const GLenum INVERT = 0x150A;
- const GLenum INCR_WRAP = 0x8507;
- const GLenum DECR_WRAP = 0x8508;
-
- /* StringName */
- const GLenum VENDOR = 0x1F00;
- const GLenum RENDERER = 0x1F01;
- const GLenum VERSION = 0x1F02;
-
- /* TextureMagFilter */
- const GLenum NEAREST = 0x2600;
- const GLenum LINEAR = 0x2601;
-
- /* TextureMinFilter */
- /* NEAREST */
- /* LINEAR */
- const GLenum NEAREST_MIPMAP_NEAREST = 0x2700;
- const GLenum LINEAR_MIPMAP_NEAREST = 0x2701;
- const GLenum NEAREST_MIPMAP_LINEAR = 0x2702;
- const GLenum LINEAR_MIPMAP_LINEAR = 0x2703;
-
- /* TextureParameterName */
- const GLenum TEXTURE_MAG_FILTER = 0x2800;
- const GLenum TEXTURE_MIN_FILTER = 0x2801;
- const GLenum TEXTURE_WRAP_S = 0x2802;
- const GLenum TEXTURE_WRAP_T = 0x2803;
-
- /* TextureTarget */
- const GLenum TEXTURE_2D = 0x0DE1;
- const GLenum TEXTURE = 0x1702;
-
- const GLenum TEXTURE_CUBE_MAP = 0x8513;
- const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514;
- const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
- const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
- const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
- const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
- const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
- const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
- const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
-
- /* TextureUnit */
- const GLenum TEXTURE0 = 0x84C0;
- const GLenum TEXTURE1 = 0x84C1;
- const GLenum TEXTURE2 = 0x84C2;
- const GLenum TEXTURE3 = 0x84C3;
- const GLenum TEXTURE4 = 0x84C4;
- const GLenum TEXTURE5 = 0x84C5;
- const GLenum TEXTURE6 = 0x84C6;
- const GLenum TEXTURE7 = 0x84C7;
- const GLenum TEXTURE8 = 0x84C8;
- const GLenum TEXTURE9 = 0x84C9;
- const GLenum TEXTURE10 = 0x84CA;
- const GLenum TEXTURE11 = 0x84CB;
- const GLenum TEXTURE12 = 0x84CC;
- const GLenum TEXTURE13 = 0x84CD;
- const GLenum TEXTURE14 = 0x84CE;
- const GLenum TEXTURE15 = 0x84CF;
- const GLenum TEXTURE16 = 0x84D0;
- const GLenum TEXTURE17 = 0x84D1;
- const GLenum TEXTURE18 = 0x84D2;
- const GLenum TEXTURE19 = 0x84D3;
- const GLenum TEXTURE20 = 0x84D4;
- const GLenum TEXTURE21 = 0x84D5;
- const GLenum TEXTURE22 = 0x84D6;
- const GLenum TEXTURE23 = 0x84D7;
- const GLenum TEXTURE24 = 0x84D8;
- const GLenum TEXTURE25 = 0x84D9;
- const GLenum TEXTURE26 = 0x84DA;
- const GLenum TEXTURE27 = 0x84DB;
- const GLenum TEXTURE28 = 0x84DC;
- const GLenum TEXTURE29 = 0x84DD;
- const GLenum TEXTURE30 = 0x84DE;
- const GLenum TEXTURE31 = 0x84DF;
- const GLenum ACTIVE_TEXTURE = 0x84E0;
-
- /* TextureWrapMode */
- const GLenum REPEAT = 0x2901;
- const GLenum CLAMP_TO_EDGE = 0x812F;
- const GLenum MIRRORED_REPEAT = 0x8370;
-
- /* Uniform Types */
- const GLenum FLOAT_VEC2 = 0x8B50;
- const GLenum FLOAT_VEC3 = 0x8B51;
- const GLenum FLOAT_VEC4 = 0x8B52;
- const GLenum INT_VEC2 = 0x8B53;
- const GLenum INT_VEC3 = 0x8B54;
- const GLenum INT_VEC4 = 0x8B55;
- const GLenum BOOL = 0x8B56;
- const GLenum BOOL_VEC2 = 0x8B57;
- const GLenum BOOL_VEC3 = 0x8B58;
- const GLenum BOOL_VEC4 = 0x8B59;
- const GLenum FLOAT_MAT2 = 0x8B5A;
- const GLenum FLOAT_MAT3 = 0x8B5B;
- const GLenum FLOAT_MAT4 = 0x8B5C;
- const GLenum SAMPLER_2D = 0x8B5E;
- const GLenum SAMPLER_CUBE = 0x8B60;
-
- /* Vertex Arrays */
- const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
- const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
- const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
- const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
- const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
- const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
- const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
-
- /* Shader Source */
- const GLenum COMPILE_STATUS = 0x8B81;
-
- /* Shader Precision-Specified Types */
- const GLenum LOW_FLOAT = 0x8DF0;
- const GLenum MEDIUM_FLOAT = 0x8DF1;
- const GLenum HIGH_FLOAT = 0x8DF2;
- const GLenum LOW_INT = 0x8DF3;
- const GLenum MEDIUM_INT = 0x8DF4;
- const GLenum HIGH_INT = 0x8DF5;
-
- /* Framebuffer Object. */
- const GLenum FRAMEBUFFER = 0x8D40;
- const GLenum RENDERBUFFER = 0x8D41;
-
- const GLenum RGBA4 = 0x8056;
- const GLenum RGB5_A1 = 0x8057;
- const GLenum RGB565 = 0x8D62;
- const GLenum DEPTH_COMPONENT16 = 0x81A5;
- const GLenum STENCIL_INDEX = 0x1901;
- const GLenum STENCIL_INDEX8 = 0x8D48;
- const GLenum DEPTH_STENCIL = 0x84F9;
-
- const GLenum RENDERBUFFER_WIDTH = 0x8D42;
- const GLenum RENDERBUFFER_HEIGHT = 0x8D43;
- const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
- const GLenum RENDERBUFFER_RED_SIZE = 0x8D50;
- const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51;
- const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52;
- const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53;
- const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54;
- const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55;
-
- const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
- const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
- const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
- const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
-
- const GLenum COLOR_ATTACHMENT0 = 0x8CE0;
- const GLenum DEPTH_ATTACHMENT = 0x8D00;
- const GLenum STENCIL_ATTACHMENT = 0x8D20;
- const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
-
- const GLenum NONE = 0;
-
- const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5;
- const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
- const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
- const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
- const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
-
- const GLenum FRAMEBUFFER_BINDING = 0x8CA6;
- const GLenum RENDERBUFFER_BINDING = 0x8CA7;
- const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8;
-
- const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506;
-
- /* WebGL-specific enums */
- const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240;
- const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
- const GLenum CONTEXT_LOST_WEBGL = 0x9242;
- const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
- const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
-
- readonly attribute HTMLCanvasElement canvas;
- readonly attribute GLsizei drawingBufferWidth;
- readonly attribute GLsizei drawingBufferHeight;
-
- [WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes();
- [WebGLHandlesContextLoss] boolean isContextLost();
-
- sequence<DOMString>? getSupportedExtensions();
- object? getExtension(DOMString name);
-
- void activeTexture(GLenum texture);
- void attachShader(WebGLProgram? program, WebGLShader? shader);
- void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
- void bindBuffer(GLenum target, WebGLBuffer? buffer);
- void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
- void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
- void bindTexture(GLenum target, WebGLTexture? texture);
- void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void blendEquation(GLenum mode);
- void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
- void blendFunc(GLenum sfactor, GLenum dfactor);
- void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
- GLenum srcAlpha, GLenum dstAlpha);
-
- void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
- void bufferData(GLenum target, ArrayBufferView data, GLenum usage);
- void bufferData(GLenum target, ArrayBuffer? data, GLenum usage);
- void bufferSubData(GLenum target, GLintptr offset, ArrayBufferView data);
- void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer? data);
-
- [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
- void clear(GLbitfield mask);
- void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void clearDepth(GLclampf depth);
- void clearStencil(GLint s);
- void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void compileShader(WebGLShader? shader);
-
- void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
- GLsizei width, GLsizei height, GLint border,
- ArrayBufferView data);
- void compressedTexSubImage2D(GLenum target, GLint level,
- GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height, GLenum format,
- ArrayBufferView data);
-
- void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLint border);
- void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLint x, GLint y, GLsizei width, GLsizei height);
-
- WebGLBuffer? createBuffer();
- WebGLFramebuffer? createFramebuffer();
- WebGLProgram? createProgram();
- WebGLRenderbuffer? createRenderbuffer();
- WebGLShader? createShader(GLenum type);
- WebGLTexture? createTexture();
-
- void cullFace(GLenum mode);
-
- void deleteBuffer(WebGLBuffer? buffer);
- void deleteFramebuffer(WebGLFramebuffer? framebuffer);
- void deleteProgram(WebGLProgram? program);
- void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer);
- void deleteShader(WebGLShader? shader);
- void deleteTexture(WebGLTexture? texture);
-
- void depthFunc(GLenum func);
- void depthMask(GLboolean flag);
- void depthRange(GLclampf zNear, GLclampf zFar);
- void detachShader(WebGLProgram? program, WebGLShader? shader);
- void disable(GLenum cap);
- void disableVertexAttribArray(GLuint index);
- void drawArrays(GLenum mode, GLint first, GLsizei count);
- void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
-
- void enable(GLenum cap);
- void enableVertexAttribArray(GLuint index);
- void finish();
- void flush();
- void framebufferRenderbuffer(GLenum target, GLenum attachment,
- GLenum renderbuffertarget,
- WebGLRenderbuffer? renderbuffer);
- void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
- WebGLTexture? texture, GLint level);
- void frontFace(GLenum mode);
-
- void generateMipmap(GLenum target);
-
- WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, GLuint index);
- WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index);
- sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
-
- [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram? program, DOMString name);
-
- any getBufferParameter(GLenum target, GLenum pname);
- any getParameter(GLenum pname);
-
- [WebGLHandlesContextLoss] GLenum getError();
-
- any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
- GLenum pname);
- any getProgramParameter(WebGLProgram? program, GLenum pname);
- DOMString? getProgramInfoLog(WebGLProgram? program);
- any getRenderbufferParameter(GLenum target, GLenum pname);
- any getShaderParameter(WebGLShader? shader, GLenum pname);
- WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
- DOMString? getShaderInfoLog(WebGLShader? shader);
-
- DOMString? getShaderSource(WebGLShader? shader);
-
- any getTexParameter(GLenum target, GLenum pname);
-
- any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
-
- WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name);
-
- any getVertexAttrib(GLuint index, GLenum pname);
-
- [WebGLHandlesContextLoss] GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname);
-
- void hint(GLenum target, GLenum mode);
- [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer);
- [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap);
- [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer);
- [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
- [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
- [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
- [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
- void lineWidth(GLfloat width);
- void linkProgram(WebGLProgram? program);
- void pixelStorei(GLenum pname, GLint param);
- void polygonOffset(GLfloat factor, GLfloat units);
-
- void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, ArrayBufferView? pixels);
-
- void renderbufferStorage(GLenum target, GLenum internalformat,
- GLsizei width, GLsizei height);
- void sampleCoverage(GLclampf value, GLboolean invert);
- void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
-
- void shaderSource(WebGLShader? shader, DOMString source);
-
- void stencilFunc(GLenum func, GLint ref, GLuint mask);
- void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void stencilMask(GLuint mask);
- void stencilMaskSeparate(GLenum face, GLuint mask);
- void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
-
- void texImage2D(GLenum target, GLint level, GLenum internalformat,
- GLsizei width, GLsizei height, GLint border, GLenum format,
- GLenum type, ArrayBufferView? pixels);
- void texImage2D(GLenum target, GLint level, GLenum internalformat,
- GLenum format, GLenum type, ImageData? pixels);
- void texImage2D(GLenum target, GLint level, GLenum internalformat,
- GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException
- void texImage2D(GLenum target, GLint level, GLenum internalformat,
- GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException
- void texImage2D(GLenum target, GLint level, GLenum internalformat,
- GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
-
- void texParameterf(GLenum target, GLenum pname, GLfloat param);
- void texParameteri(GLenum target, GLenum pname, GLint param);
-
- void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height,
- GLenum format, GLenum type, ArrayBufferView? pixels);
- void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLenum format, GLenum type, ImageData? pixels);
- void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException
- void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException
- void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
-
- void uniform1f(WebGLUniformLocation? location, GLfloat x);
- void uniform1fv(WebGLUniformLocation? location, Float32Array v);
- void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v);
- void uniform1i(WebGLUniformLocation? location, GLint x);
- void uniform1iv(WebGLUniformLocation? location, Int32Array v);
- void uniform1iv(WebGLUniformLocation? location, sequence<long> v);
- void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
- void uniform2fv(WebGLUniformLocation? location, Float32Array v);
- void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v);
- void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
- void uniform2iv(WebGLUniformLocation? location, Int32Array v);
- void uniform2iv(WebGLUniformLocation? location, sequence<long> v);
- void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
- void uniform3fv(WebGLUniformLocation? location, Float32Array v);
- void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v);
- void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
- void uniform3iv(WebGLUniformLocation? location, Int32Array v);
- void uniform3iv(WebGLUniformLocation? location, sequence<long> v);
- void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void uniform4fv(WebGLUniformLocation? location, Float32Array v);
- void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v);
- void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
- void uniform4iv(WebGLUniformLocation? location, Int32Array v);
- void uniform4iv(WebGLUniformLocation? location, sequence<long> v);
-
- void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
- Float32Array value);
- void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
- sequence<GLfloat> value);
- void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
- Float32Array value);
- void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
- sequence<GLfloat> value);
- void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
- Float32Array value);
- void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
- sequence<GLfloat> value);
-
- void useProgram(WebGLProgram? program);
- void validateProgram(WebGLProgram? program);
-
- void vertexAttrib1f(GLuint indx, GLfloat x);
- void vertexAttrib1fv(GLuint indx, Float32Array values);
- void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values);
- void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
- void vertexAttrib2fv(GLuint indx, Float32Array values);
- void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values);
- void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
- void vertexAttrib3fv(GLuint indx, Float32Array values);
- void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values);
- void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void vertexAttrib4fv(GLuint indx, Float32Array values);
- void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values);
- void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
- GLboolean normalized, GLsizei stride, GLintptr offset);
-
- void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
-};
-
-interface WebGLRenderingContext implements WebGLRenderingContextBase
-{
-};
-
-
-[Constructor(DOMString type, optional WebGLContextEventInit eventInit)]
-interface WebGLContextEvent : Event {
- readonly attribute DOMString statusMessage;
-};
-
-// EventInit is defined in the DOM4 specification.
-dictionary WebGLContextEventInit : EventInit {
- DOMString statusMessage;
-};
diff --git a/doc/.requirements b/doc/.requirements
deleted file mode 100644
index 59a31d3..0000000
--- a/doc/.requirements
+++ /dev/null
@@ -1,3 +0,0 @@
-PyOpenGL>=3.0.2
-numpy>=1.6
-
diff --git a/doc/Makefile b/doc/Makefile
deleted file mode 100644
index b79ef5c..0000000
--- a/doc/Makefile
+++ /dev/null
@@ -1,160 +0,0 @@
-# Makefile for Sphinx documentation
-#
-
-# You can set these variables from the command line.
-SPHINXOPTS =
-SPHINXBUILD = sphinx-build
-PAPER =
-BUILDDIR = _build
-
-# Internal variables.
-PAPEROPT_a4 = -D latex_paper_size=a4
-PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
-# the i18n builder cannot share the environment and doctrees with the others
-I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
-
-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
-
-help:
- @echo "Please use \`make <target>' where <target> is one of"
- @echo " html to make standalone HTML files"
- @echo " dirhtml to make HTML files named index.html in directories"
- @echo " singlehtml to make a single large HTML file"
- @echo " pickle to make pickle files"
- @echo " json to make JSON files"
- @echo " htmlhelp to make HTML files and a HTML help project"
- @echo " qthelp to make HTML files and a qthelp project"
- @echo " devhelp to make HTML files and a Devhelp project"
- @echo " epub to make an epub"
- @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
- @echo " latexpdf to make LaTeX files and run them through pdflatex"
- @echo " text to make text files"
- @echo " man to make manual pages"
- @echo " texinfo to make Texinfo files"
- @echo " info to make Texinfo files and run them through makeinfo"
- @echo " gettext to make PO message catalogs"
- @echo " changes to make an overview of all changed/added/deprecated items"
- @echo " linkcheck to check all external links for integrity"
- @echo " doctest to run all doctests embedded in the documentation (if enabled)"
-
-clean:
- -rm -rf $(BUILDDIR)/*
-
-html:
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
-
-dirhtml:
- $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
-
-singlehtml:
- $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
- @echo
- @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
-
-pickle:
- $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
- @echo
- @echo "Build finished; now you can process the pickle files."
-
-json:
- $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
- @echo
- @echo "Build finished; now you can process the JSON files."
-
-htmlhelp:
- $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
- @echo
- @echo "Build finished; now you can run HTML Help Workshop with the" \
- ".hhp project file in $(BUILDDIR)/htmlhelp."
-
-qthelp:
- $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
- @echo
- @echo "Build finished; now you can run "qcollectiongenerator" with the" \
- ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
- @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/vispy.qhcp"
- @echo "To view the help file:"
- @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/vispy.qhc"
-
-devhelp:
- $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
- @echo
- @echo "Build finished."
- @echo "To view the help file:"
- @echo "# mkdir -p $$HOME/.local/share/devhelp/vispy"
- @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/vispy"
- @echo "# devhelp"
-
-epub:
- $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
- @echo
- @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
-
-latex:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo
- @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
- @echo "Run \`make' in that directory to run these through (pdf)latex" \
- "(use \`make latexpdf' here to do that automatically)."
-
-latexpdf:
- $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
- @echo "Running LaTeX files through pdflatex..."
- $(MAKE) -C $(BUILDDIR)/latex all-pdf
- @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
-
-text:
- $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
- @echo
- @echo "Build finished. The text files are in $(BUILDDIR)/text."
-
-man:
- $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
- @echo
- @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
-
-texinfo:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo
- @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
- @echo "Run \`make' in that directory to run these through makeinfo" \
- "(use \`make info' here to do that automatically)."
-
-info:
- $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
- @echo "Running Texinfo files through makeinfo..."
- make -C $(BUILDDIR)/texinfo info
- @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
-
-gettext:
- $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
- @echo
- @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
-
-changes:
- $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
- @echo
- @echo "The overview file is in $(BUILDDIR)/changes."
-
-linkcheck:
- $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
- @echo
- @echo "Link check complete; look for any errors in the above output " \
- "or in $(BUILDDIR)/linkcheck/output.txt."
-
-doctest:
- $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
- @echo "Testing of doctests in the sources finished, look at the " \
- "results in $(BUILDDIR)/doctest/output.txt."
-
-showinchrome:
- google-chrome _build/html/index.html
-
-showinff:
- firefox _build/html/index.html
-
diff --git a/doc/_templates/localtoc.html b/doc/_templates/localtoc.html
deleted file mode 100644
index c7e0f04..0000000
--- a/doc/_templates/localtoc.html
+++ /dev/null
@@ -1,10 +0,0 @@
-{% if pagename != 'index' %}
-
- {%- if display_toc %}
- <h4 class="sidebar-box-heading">Contents</h4>
- <div class="well sidebar-box toc">
- {{ toc|replace('<ul>', '<ul class="nav nav-list">') }}
- </div>
- {%- endif %}
-
-{% endif %}
\ No newline at end of file
diff --git a/doc/_templates/navbar.html b/doc/_templates/navbar.html
deleted file mode 100644
index 78c883b..0000000
--- a/doc/_templates/navbar.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<li><a href="http://vispy.org">Home</a></li>
-<li><a href="http://vispy.org/gallery.html">Gallery</a></li>
-<li><a href="http://api.vispy.org">Documentation</a></li>
-<li><a href="https://github.com/vispy/vispy">Source</a></li>
diff --git a/doc/_templates/navigation.html b/doc/_templates/navigation.html
deleted file mode 100644
index 127bdd2..0000000
--- a/doc/_templates/navigation.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<h4 class="sidebar-box-heading">{{ _('Navigation') }}</h4>
-<div class="well sidebar-box">
- <ul class="nav nav-list">
- <li><a href="{{ pathto(master_doc) }}">Documentation Home</a></li>
- {% if prev %}
- <li>Previous: <a href="{{ prev.link|e }}" title="{{ _('previous chapter') }}">{{ prev.title }}</a></li>
- {% endif %}
- {% if next %}
- <li>Next: <a href="{{ next.link|e }}" title="{{ _('next chapter') }}">{{ next.title }}</a></li>
- {% endif %}
- </ul>
-</div>
diff --git a/doc/_templates/versions.html b/doc/_templates/versions.html
deleted file mode 100644
index ed6d9f7..0000000
--- a/doc/_templates/versions.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<h4 class="sidebar-box-heading">{{ _('Versions') }}</h4>
-<div class="well sidebar-box">
- <ul class="nav nav-list">
- <script src="{{ pathto('_static/', 1) }}js/docversions.js"></script>
- <script type="text/javascript">
- insert_version_links();
- </script>
- </ul>
-</div>
\ No newline at end of file
diff --git a/doc/app.rst b/doc/app.rst
deleted file mode 100644
index 3676325..0000000
--- a/doc/app.rst
+++ /dev/null
@@ -1,32 +0,0 @@
-==============
-The app module
-==============
-
-.. automodule:: vispy.app
-
-----
-
-.. autofunction:: vispy.app.use_app
-
-.. autofunction:: vispy.app.create
-
-.. autofunction:: vispy.app.run
-
-.. autofunction:: vispy.app.quit
-
-.. autofunction:: vispy.app.process_events
-
-----
-
-.. autoclass:: vispy.app.Application
- :members:
-
-----
-
-.. autoclass:: vispy.app.Canvas
- :members:
-
-----
-
-.. autoclass:: vispy.app.Timer
- :members:
diff --git a/doc/color.rst b/doc/color.rst
deleted file mode 100644
index a4e682b..0000000
--- a/doc/color.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-================
-The color module
-================
-
-.. automodule:: vispy.color
- :members:
diff --git a/doc/conf.py b/doc/conf.py
deleted file mode 100644
index 23981b2..0000000
--- a/doc/conf.py
+++ /dev/null
@@ -1,284 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# vispy documentation build configuration file, created by
-# sphinx-quickstart on Sat May 4 16:52:02 2013.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-import sys
-import os
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-sys.path.insert(0, os.path.abspath('..'))
-#sys.path.insert(0, os.path.abspath('.'))
-curpath = os.path.dirname(__file__)
-sys.path.append(os.path.abspath('ext'))
-
-# -- General configuration -----------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.pngmath',
- 'sphinx.ext.autosummary', # 'plot2rst',
- 'sphinx.ext.intersphinx',
- 'numpydoc',
- 'vispy_ext', ] # 'scriptnamemangler',]
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix of source filenames.
-source_suffix = '.rst'
-
-# The encoding of source files.
-#source_encoding = 'utf-8-sig'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = u'vispy'
-copyright = u'2013, vispy contributers'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-import vispy
-# The short X.Y version.
-version = vispy.__version__[:3]
-# The full version, including alpha/beta/rc tags.
-release = vispy.__version__
-
-
-# -- General configuration -----------------------------------------------
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
-# List of documents that shouldn't be included in the build.
-#unused_docs = []
-
-# List of directories, relative to source directory, that shouldn't be searched
-# for source files.
-exclude_trees = []
-
-# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-#add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-#show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
-
-
-# -- Options for HTML output ---------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. Major themes that come with
-# Sphinx are currently 'default' and 'sphinxdoc'.
-html_theme = 'scikit-image'
-
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-#html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-html_theme_path = ['themes']
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# "<project> v<release> documentation".
-html_title = 'vispy v%s docs' % version
-
-# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
-
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-#html_favicon = None
-
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = [] # '_static']
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-#html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-html_sidebars = {
- '**': ['navigation.html',
- 'localtoc.html',
- #'versions.html'
- ],
-}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-# html_additional_pages = {}
-
-# If false, no module index is generated.
-#html_use_modindex = True
-
-# If false, no index is generated.
-#html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-#html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
-
-# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
-
-# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a <link> tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
-
-# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = ''
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'vispydoc'
-
-
-# -- Options for LaTeX output --------------------------------------------
-
-# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
-
-# The font size ('10pt', '11pt' or '12pt').
-latex_font_size = '10pt'
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
-latex_documents = [
- ('contents', 'vispy.tex', u'The visoy Documentation',
- u'vispy development team', 'manual'),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-#latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-#latex_use_parts = False
-
-# Additional stuff for the LaTeX preamble.
-latex_preamble = r'''
-\usepackage{enumitem}
-\setlistdepth{100}
-
-\usepackage{amsmath}
-\DeclareUnicodeCharacter{00A0}{\nobreakspace}
-
-% In the parameters section, place a newline after the Parameters header
-\usepackage{expdlist}
-\let\latexdescription=\description
-\def\description{\latexdescription{}{} \breaklabel}
-
-% Make Examples/etc section headers smaller and more compact
-\makeatletter
-\titleformat{\paragraph}{\normalsize\py at HeaderFamily}%
-{\py at TitleColor}{0em}{\py at TitleColor}{\py at NormalColor}
-\titlespacing*{\paragraph}{0pt}{1ex}{0pt}
-\makeatother
-
-'''
-
-# Documents to append as an appendix to all manuals.
-#latex_appendices = []
-
-# If false, no module index is generated.
-latex_use_modindex = False
-
-# -----------------------------------------------------------------------------
-# Numpy extensions
-# -----------------------------------------------------------------------------
-numpydoc_show_class_members = False
-
-# -----------------------------------------------------------------------------
-# Plots
-# -----------------------------------------------------------------------------
-plot_basedir = os.path.join(curpath, "plots")
-plot_pre_code = """
-import numpy as np
-import matplotlib.pyplot as plt
-np.random.seed(0)
-
-import matplotlib
-matplotlib.rcParams.update({
-'font.size': 14,
-'axes.titlesize': 12,
-'axes.labelsize': 10,
-'xtick.labelsize': 8,
-'ytick.labelsize': 8,
-'legend.fontsize': 10,
-'figure.subplot.bottom': 0.2,
-'figure.subplot.left': 0.2,
-'figure.subplot.right': 0.9,
-'figure.subplot.top': 0.85,
-'figure.subplot.wspace': 0.4,
-'text.usetex': False,
-})
-
-"""
-plot_include_source = True
-plot_formats = [('png', 100), ('pdf', 100)]
-
-plot2rst_index_name = 'README'
-plot2rst_rcparams = {'image.cmap': 'gray',
- 'image.interpolation': 'none'}
-
-# -----------------------------------------------------------------------------
-# intersphinx
-# -----------------------------------------------------------------------------
-_python_doc_base = 'http://docs.python.org/2.7'
-intersphinx_mapping = {
- _python_doc_base: None,
- 'http://docs.scipy.org/doc/numpy': None,
- 'http://docs.scipy.org/doc/scipy/reference': None,
- 'http://vispy.org/stable': None
-}
diff --git a/doc/ext/docscrape.py b/doc/ext/docscrape.py
deleted file mode 100644
index 1b4757c..0000000
--- a/doc/ext/docscrape.py
+++ /dev/null
@@ -1,515 +0,0 @@
-"""Extract reference documentation from the NumPy source tree.
-
-"""
-
-import inspect
-import textwrap
-import re
-import pydoc
-try:
- from StringIO import StringIO
-except ImportError:
- from io import StringIO
-from warnings import warn
-
-
-class Reader(object):
-
- """A line-based string reader.
-
- """
-
- def __init__(self, data):
- """
- Parameters
- ----------
- data : str
- String with lines separated by '\n'.
-
- """
- if isinstance(data, list):
- self._str = data
- else:
- self._str = data.split('\n') # store string as list of lines
-
- self.reset()
-
- def __getitem__(self, n):
- return self._str[n]
-
- def reset(self):
- self._l = 0 # current line nr
-
- def read(self):
- if not self.eof():
- out = self[self._l]
- self._l += 1
- return out
- else:
- return ''
-
- def seek_next_non_empty_line(self):
- for l in self[self._l:]:
- if l.strip():
- break
- else:
- self._l += 1
-
- def eof(self):
- return self._l >= len(self._str)
-
- def read_to_condition(self, condition_func):
- start = self._l
- for line in self[start:]:
- if condition_func(line):
- return self[start:self._l]
- self._l += 1
- if self.eof():
- return self[start:self._l + 1]
- return []
-
- def read_to_next_empty_line(self):
- self.seek_next_non_empty_line()
-
- def is_empty(line):
- return not line.strip()
- return self.read_to_condition(is_empty)
-
- def read_to_next_unindented_line(self):
- def is_unindented(line):
- return (line.strip() and (len(line.lstrip()) == len(line)))
- return self.read_to_condition(is_unindented)
-
- def peek(self, n=0):
- if self._l + n < len(self._str):
- return self[self._l + n]
- else:
- return ''
-
- def is_empty(self):
- return not ''.join(self._str).strip()
-
-
-class NumpyDocString(object):
-
- def __init__(self, docstring, config={}):
- docstring = textwrap.dedent(docstring).split('\n')
-
- self._doc = Reader(docstring)
- self._parsed_data = {
- 'Signature': '',
- 'Summary': [''],
- 'Extended Summary': [],
- 'Parameters': [],
- 'Returns': [],
- 'Raises': [],
- 'Warns': [],
- 'Other Parameters': [],
- 'Attributes': [],
- 'Methods': [],
- 'See Also': [],
- 'Notes': [],
- 'Warnings': [],
- 'References': '',
- 'Examples': '',
- 'index': {}
- }
-
- self._parse()
-
- def __getitem__(self, key):
- return self._parsed_data[key]
-
- def __setitem__(self, key, val):
- if not key in self._parsed_data:
- warn("Unknown section %s" % key)
- else:
- self._parsed_data[key] = val
-
- def _is_at_section(self):
- self._doc.seek_next_non_empty_line()
-
- if self._doc.eof():
- return False
-
- l1 = self._doc.peek().strip() # e.g. Parameters
-
- if l1.startswith('.. index::'):
- return True
-
- l2 = self._doc.peek(1).strip() # ---------- or ==========
- return l2.startswith('-' * len(l1)) or l2.startswith('=' * len(l1))
-
- def _strip(self, doc):
- i = 0
- j = 0
- for i, line in enumerate(doc):
- if line.strip():
- break
-
- for j, line in enumerate(doc[::-1]):
- if line.strip():
- break
-
- return doc[i:len(doc) - j]
-
- def _read_to_next_section(self):
- section = self._doc.read_to_next_empty_line()
-
- while not self._is_at_section() and not self._doc.eof():
- if not self._doc.peek(-1).strip(): # previous line was empty
- section += ['']
-
- section += self._doc.read_to_next_empty_line()
-
- return section
-
- def _read_sections(self):
- while not self._doc.eof():
- data = self._read_to_next_section()
- name = data[0].strip()
-
- if name.startswith('..'): # index section
- yield name, data[1:]
- elif len(data) < 2:
- yield StopIteration
- else:
- yield name, self._strip(data[2:])
-
- def _parse_param_list(self, content):
- r = Reader(content)
- params = []
- while not r.eof():
- header = r.read().strip()
- if ' : ' in header:
- arg_name, arg_type = header.split(' : ')[:2]
- else:
- arg_name, arg_type = header, ''
-
- desc = r.read_to_next_unindented_line()
- desc = dedent_lines(desc)
-
- params.append((arg_name, arg_type, desc))
-
- return params
-
- _name_rgx = re.compile(r"^\s*(:(?P<role>\w+):`(?P<name>[a-zA-Z0-9_.-]+)`|"
- r" (?P<name2>[a-zA-Z0-9_.-]+))\s*", re.X)
-
- def _parse_see_also(self, content):
- """
- func_name : Descriptive text
- continued text
- another_func_name : Descriptive text
- func_name1, func_name2, :meth:`func_name`, func_name3
-
- """
- items = []
-
- def parse_item_name(text):
- """Match ':role:`name`' or 'name'"""
- m = self._name_rgx.match(text)
- if m:
- g = m.groups()
- if g[1] is None:
- return g[3], None
- else:
- return g[2], g[1]
- raise ValueError("%s is not a item name" % text)
-
- def push_item(name, rest):
- if not name:
- return
- name, role = parse_item_name(name)
- items.append((name, list(rest), role))
- del rest[:]
-
- current_func = None
- rest = []
-
- for line in content:
- if not line.strip():
- continue
-
- m = self._name_rgx.match(line)
- if m and line[m.end():].strip().startswith(':'):
- push_item(current_func, rest)
- current_func, line = line[:m.end()], line[m.end():]
- rest = [line.split(':', 1)[1].strip()]
- if not rest[0]:
- rest = []
- elif not line.startswith(' '):
- push_item(current_func, rest)
- current_func = None
- if ',' in line:
- for func in line.split(','):
- push_item(func, [])
- elif line.strip():
- current_func = line
- elif current_func is not None:
- rest.append(line.strip())
- push_item(current_func, rest)
- return items
-
- def _parse_index(self, section, content):
- """
- .. index: default
- :refguide: something, else, and more
-
- """
- def strip_each_in(lst):
- return [s.strip() for s in lst]
-
- out = {}
- section = section.split('::')
- if len(section) > 1:
- out['default'] = strip_each_in(section[1].split(','))[0]
- for line in content:
- line = line.split(':')
- if len(line) > 2:
- out[line[1]] = strip_each_in(line[2].split(','))
- return out
-
- def _parse_summary(self):
- """Grab signature (if given) and summary"""
- if self._is_at_section():
- return
-
- summary = self._doc.read_to_next_empty_line()
- summary_str = " ".join([s.strip() for s in summary]).strip()
- if re.compile('^([\w., ]+=)?\s*[\w\.]+\(.*\)$').match(summary_str):
- self['Signature'] = summary_str
- if not self._is_at_section():
- self['Summary'] = self._doc.read_to_next_empty_line()
- else:
- self['Summary'] = summary
-
- if not self._is_at_section():
- self['Extended Summary'] = self._read_to_next_section()
-
- def _parse(self):
- self._doc.reset()
- self._parse_summary()
-
- for (section, content) in self._read_sections():
- if not section.startswith('..'):
- section = ' '.join([s.capitalize()
- for s in section.split(' ')])
- if section in ('Parameters', 'Attributes', 'Methods',
- 'Returns', 'Raises', 'Warns'):
- self[section] = self._parse_param_list(content)
- elif section.startswith('.. index::'):
- self['index'] = self._parse_index(section, content)
- elif section == 'See Also':
- self['See Also'] = self._parse_see_also(content)
- else:
- self[section] = content
-
- # string conversion routines
-
- def _str_header(self, name, symbol='-'):
- return [name, len(name) * symbol]
-
- def _str_indent(self, doc, indent=4):
- out = []
- for line in doc:
- out += [' ' * indent + line]
- return out
-
- def _str_signature(self):
- if self['Signature']:
- return [self['Signature'].replace('*', '\*')] + ['']
- else:
- return ['']
-
- def _str_summary(self):
- if self['Summary']:
- return self['Summary'] + ['']
- else:
- return []
-
- def _str_extended_summary(self):
- if self['Extended Summary']:
- return self['Extended Summary'] + ['']
- else:
- return []
-
- def _str_param_list(self, name):
- out = []
- if self[name]:
- out += self._str_header(name)
- for param, param_type, desc in self[name]:
- out += ['%s : %s' % (param, param_type)]
- out += self._str_indent(desc)
- out += ['']
- return out
-
- def _str_section(self, name):
- out = []
- if self[name]:
- out += self._str_header(name)
- out += self[name]
- out += ['']
- return out
-
- def _str_see_also(self, func_role):
- if not self['See Also']:
- return []
- out = []
- out += self._str_header("See Also")
- last_had_desc = True
- for func, desc, role in self['See Also']:
- if role:
- link = ':%s:`%s`' % (role, func)
- elif func_role:
- link = ':%s:`%s`' % (func_role, func)
- else:
- link = "`%s`_" % func
- if desc or last_had_desc:
- out += ['']
- out += [link]
- else:
- out[-1] += ", %s" % link
- if desc:
- out += self._str_indent([' '.join(desc)])
- last_had_desc = True
- else:
- last_had_desc = False
- out += ['']
- return out
-
- def _str_index(self):
- idx = self['index']
- out = []
- out += ['.. index:: %s' % idx.get('default', '')]
- for section, references in idx.items():
- if section == 'default':
- continue
- out += [' :%s: %s' % (section, ', '.join(references))]
- return out
-
- def __str__(self, func_role=''):
- out = []
- out += self._str_signature()
- out += self._str_summary()
- out += self._str_extended_summary()
- for param_list in ('Parameters', 'Returns', 'Raises'):
- out += self._str_param_list(param_list)
- out += self._str_section('Warnings')
- out += self._str_see_also(func_role)
- for s in ('Notes', 'References', 'Examples'):
- out += self._str_section(s)
- for param_list in ('Attributes', 'Methods'):
- out += self._str_param_list(param_list)
- out += self._str_index()
- return '\n'.join(out)
-
-
-def indent(str, indent=4):
- indent_str = ' ' * indent
- if str is None:
- return indent_str
- lines = str.split('\n')
- return '\n'.join(indent_str + l for l in lines)
-
-
-def dedent_lines(lines):
- """Deindent a list of lines maximally"""
- return textwrap.dedent("\n".join(lines)).split("\n")
-
-
-def header(text, style='-'):
- return text + '\n' + style * len(text) + '\n'
-
-
-class FunctionDoc(NumpyDocString):
-
- def __init__(self, func, role='func', doc=None, config={}):
- self._f = func
- self._role = role # e.g. "func" or "meth"
-
- if doc is None:
- if func is None:
- raise ValueError("No function or docstring given")
- doc = inspect.getdoc(func) or ''
- NumpyDocString.__init__(self, doc)
-
- if not self['Signature'] and func is not None:
- func, func_name = self.get_func()
- try:
- # try to read signature
- argspec = inspect.getargspec(func)
- argspec = inspect.formatargspec(*argspec)
- argspec = argspec.replace('*', '\*')
- signature = '%s%s' % (func_name, argspec)
- except TypeError as e:
- signature = '%s()' % func_name
- self['Signature'] = signature
-
- def get_func(self):
- func_name = getattr(self._f, '__name__', self.__class__.__name__)
- if inspect.isclass(self._f):
- func = getattr(self._f, '__call__', self._f.__init__)
- else:
- func = self._f
- return func, func_name
-
- def __str__(self):
- out = ''
-
- func, func_name = self.get_func()
- signature = self['Signature'].replace('*', '\*')
-
- roles = {'func': 'function',
- 'meth': 'method'}
-
- if self._role:
- if not self._role in roles:
- print("Warning: invalid role %s" % self._role)
- out += '.. %s:: %s\n \n\n' % (roles.get(self._role, ''),
- func_name)
-
- out += super(FunctionDoc, self).__str__(func_role=self._role)
- return out
-
-
-class ClassDoc(NumpyDocString):
-
- def __init__(self, cls, doc=None, modulename='', func_doc=FunctionDoc,
- config={}):
- if not inspect.isclass(cls) and cls is not None:
- raise ValueError("Expected a class or None, but got %r" % cls)
- self._cls = cls
-
- if modulename and not modulename.endswith('.'):
- modulename += '.'
- self._mod = modulename
-
- if doc is None:
- if cls is None:
- raise ValueError("No class or documentation string given")
- doc = pydoc.getdoc(cls)
-
- NumpyDocString.__init__(self, doc)
-
- if config.get('show_class_members', True):
- if not self['Methods']:
- self['Methods'] = [(name, '', '')
- for name in sorted(self.methods)]
- if not self['Attributes']:
- self['Attributes'] = [(name, '', '')
- for name in sorted(self.properties)]
-
- @property
- def methods(self):
- if self._cls is None:
- return []
- return [name for name, func in inspect.getmembers(self._cls)
- if not name.startswith('_') and callable(func)]
-
- @property
- def properties(self):
- if self._cls is None:
- return []
- return [name for name, func in inspect.getmembers(self._cls)
- if not name.startswith('_') and func is None]
diff --git a/doc/ext/docscrape_sphinx.py b/doc/ext/docscrape_sphinx.py
deleted file mode 100644
index 29ad9aa..0000000
--- a/doc/ext/docscrape_sphinx.py
+++ /dev/null
@@ -1,238 +0,0 @@
-import re
-import inspect
-import textwrap
-import pydoc
-import sphinx
-from docscrape import NumpyDocString, FunctionDoc, ClassDoc
-
-
-class SphinxDocString(NumpyDocString):
-
- def __init__(self, docstring, config={}):
- self.use_plots = config.get('use_plots', False)
- NumpyDocString.__init__(self, docstring, config=config)
-
- # string conversion routines
- def _str_header(self, name, symbol='`'):
- return ['.. rubric:: ' + name, '']
-
- def _str_field_list(self, name):
- return [':' + name + ':']
-
- def _str_indent(self, doc, indent=4):
- out = []
- for line in doc:
- out += [' ' * indent + line]
- return out
-
- def _str_signature(self):
- return ['']
- if self['Signature']:
- return ['``%s``' % self['Signature']] + ['']
- else:
- return ['']
-
- def _str_summary(self):
- return self['Summary'] + ['']
-
- def _str_extended_summary(self):
- return self['Extended Summary'] + ['']
-
- def _str_param_list(self, name):
- out = []
- if self[name]:
- out += self._str_field_list(name)
- out += ['']
- for param, param_type, desc in self[name]:
- out += self._str_indent(['**%s** : %s' % (param.strip(),
- param_type)])
- out += ['']
- out += self._str_indent(desc, 8)
- out += ['']
- return out
-
- @property
- def _obj(self):
- if hasattr(self, '_cls'):
- return self._cls
- elif hasattr(self, '_f'):
- return self._f
- return None
-
- def _str_member_list(self, name):
- """
- Generate a member listing, autosummary:: table where possible,
- and a table where not.
-
- """
- out = []
- if self[name]:
- out += ['.. rubric:: %s' % name, '']
- prefix = getattr(self, '_name', '')
-
- if prefix:
- prefix = '~%s.' % prefix
-
- autosum = []
- others = []
- for param, param_type, desc in self[name]:
- param = param.strip()
- if not self._obj or hasattr(self._obj, param):
- autosum += [" %s%s" % (prefix, param)]
- else:
- others.append((param, param_type, desc))
-
- if autosum:
- out += ['.. autosummary::', ' :toctree:', '']
- out += autosum
-
- if others:
- maxlen_0 = max([len(x[0]) for x in others])
- maxlen_1 = max([len(x[1]) for x in others])
- hdr = "=" * maxlen_0 + " " + "=" * maxlen_1 + " " + "=" * 10
- fmt = '%%%ds %%%ds ' % (maxlen_0, maxlen_1)
- n_indent = maxlen_0 + maxlen_1 + 4
- out += [hdr]
- for param, param_type, desc in others:
- out += [fmt % (param.strip(), param_type)]
- out += self._str_indent(desc, n_indent)
- out += [hdr]
- out += ['']
- return out
-
- def _str_section(self, name):
- out = []
- if self[name]:
- out += self._str_header(name)
- out += ['']
- content = textwrap.dedent("\n".join(self[name])).split("\n")
- out += content
- out += ['']
- return out
-
- def _str_see_also(self, func_role):
- out = []
- if self['See Also']:
- see_also = super(SphinxDocString, self)._str_see_also(func_role)
- out = ['.. seealso::', '']
- out += self._str_indent(see_also[2:])
- return out
-
- def _str_warnings(self):
- out = []
- if self['Warnings']:
- out = ['.. warning::', '']
- out += self._str_indent(self['Warnings'])
- return out
-
- def _str_index(self):
- idx = self['index']
- out = []
- if len(idx) == 0:
- return out
-
- out += ['.. index:: %s' % idx.get('default', '')]
- for section, references in idx.items():
- if section == 'default':
- continue
- elif section == 'refguide':
- out += [' single: %s' % (', '.join(references))]
- else:
- out += [' %s: %s' % (section, ','.join(references))]
- return out
-
- def _str_references(self):
- out = []
- if self['References']:
- out += self._str_header('References')
- if isinstance(self['References'], str):
- self['References'] = [self['References']]
- out.extend(self['References'])
- out += ['']
- # Latex collects all references to a separate bibliography,
- # so we need to insert links to it
- if sphinx.__version__ >= "0.6":
- out += ['.. only:: latex', '']
- else:
- out += ['.. latexonly::', '']
- items = []
- for line in self['References']:
- m = re.match(r'.. \[([a-z0-9._-]+)\]', line, re.I)
- if m:
- items.append(m.group(1))
- out += [' ' + ", ".join(["[%s]_" % item for item in items]), '']
- return out
-
- def _str_examples(self):
- examples_str = "\n".join(self['Examples'])
-
- if (self.use_plots and 'import matplotlib' in examples_str
- and 'plot::' not in examples_str):
- out = []
- out += self._str_header('Examples')
- out += ['.. plot::', '']
- out += self._str_indent(self['Examples'])
- out += ['']
- return out
- else:
- return self._str_section('Examples')
-
- def __str__(self, indent=0, func_role="obj"):
- out = []
- out += self._str_signature()
- out += self._str_index() + ['']
- out += self._str_summary()
- out += self._str_extended_summary()
- for param_list in ('Parameters', 'Returns', 'Raises'):
- out += self._str_param_list(param_list)
- out += self._str_warnings()
- out += self._str_see_also(func_role)
- out += self._str_section('Notes')
- out += self._str_references()
- out += self._str_examples()
- for param_list in ('Attributes', 'Methods'):
- out += self._str_member_list(param_list)
- out = self._str_indent(out, indent)
- return '\n'.join(out)
-
-
-class SphinxFunctionDoc(SphinxDocString, FunctionDoc):
-
- def __init__(self, obj, doc=None, config={}):
- self.use_plots = config.get('use_plots', False)
- FunctionDoc.__init__(self, obj, doc=doc, config=config)
-
-
-class SphinxClassDoc(SphinxDocString, ClassDoc):
-
- def __init__(self, obj, doc=None, func_doc=None, config={}):
- self.use_plots = config.get('use_plots', False)
- ClassDoc.__init__(self, obj, doc=doc, func_doc=None, config=config)
-
-
-class SphinxObjDoc(SphinxDocString):
-
- def __init__(self, obj, doc=None, config={}):
- self._f = obj
- SphinxDocString.__init__(self, doc, config=config)
-
-
-def get_doc_object(obj, what=None, doc=None, config={}):
- if what is None:
- if inspect.isclass(obj):
- what = 'class'
- elif inspect.ismodule(obj):
- what = 'module'
- elif callable(obj):
- what = 'function'
- else:
- what = 'object'
- if what == 'class':
- return SphinxClassDoc(obj, func_doc=SphinxFunctionDoc, doc=doc,
- config=config)
- elif what in ('function', 'method'):
- return SphinxFunctionDoc(obj, doc=doc, config=config)
- else:
- if doc is None:
- doc = pydoc.getdoc(obj)
- return SphinxObjDoc(obj, doc, config=config)
diff --git a/doc/ext/examplesgenerator.py b/doc/ext/examplesgenerator.py
deleted file mode 100644
index 7059664..0000000
--- a/doc/ext/examplesgenerator.py
+++ /dev/null
@@ -1,148 +0,0 @@
-""" Called from vispy_conf.py to generate the examples for the docs from the
-example Python files.
-"""
-
-from __future__ import print_function, division
-
-import os
-import sys
-import shutil
-
-try:
- from urllib2 import urlopen
-except ImportError:
- from urllib.request import urlopen # Py3k
-
-
-THIS_DIR = os.path.dirname(os.path.abspath(__file__))
-DOC_DIR = os.path.abspath(os.path.join(THIS_DIR, '..'))
-EXAMPLES_DIR = os.path.abspath(os.path.join(DOC_DIR, '..', 'examples'))
-OUTPUT_DIR = os.path.join(DOC_DIR, 'examples')
-
-
-def clean():
- # Clear examples dir
- if os.path.isdir(OUTPUT_DIR):
- shutil.rmtree(OUTPUT_DIR)
- # Clean examples file
- fname = os.path.join(DOC_DIR, 'examples.rst')
- if os.path.isfile(fname):
- os.remove(fname)
-
-
-def main():
-
- clean()
-
- if not os.path.isdir(OUTPUT_DIR):
- os.mkdir(OUTPUT_DIR)
-
- # Get examples and sort
- examples = list(get_example_filenames(EXAMPLES_DIR))
- examples.sort(key=lambda x: x[1])
-
- create_examples(examples)
- create_examples_list(examples)
-
-
-def get_example_filenames(examples_dir):
- """ Yield (filename, name) elements for all examples. The examples
- are organized in directories, therefore the name can contain a
- forward slash.
- """
- for (dirpath, dirnames, filenames) in os.walk(examples_dir):
- for fname in filenames:
- if not fname.endswith('.py'):
- continue
- filename = os.path.join(dirpath, fname)
- name = filename[len(examples_dir):].lstrip('/\\')[:-3]
- name = name.replace('\\', '/')
- yield filename, name
-
-
-def create_examples(examples):
-
- # Create doc file for each example
- count = 0
- for filename, name in examples:
- # Create title
- lines = []
- # avoid "document isn't included in any toctree" warning
- lines.append(':orphan:')
- lines.append('')
- lines.append(name)
- lines.append('-' * len(lines[-1]))
- lines.append('')
-
- # Get source
- doclines = []
- sourcelines = []
- with open(os.path.join(EXAMPLES_DIR, name + '.py')) as f:
- for line in f.readlines():
- line = line.rstrip()
- if not doclines:
- if line.startswith('"""'):
- doclines.append(line.lstrip('" '))
- sourcelines = []
- else:
- sourcelines.append(' ' + line)
- elif not sourcelines:
- if '"""' in line:
- sourcelines.append(' ' + line.partition('"""')[0])
- else:
- doclines.append(line)
- else:
- sourcelines.append(' ' + line)
-
- # Add desciprion
- lines.extend(doclines)
- lines.append('')
-
- # Add source code
- lines.append('.. code-block:: python')
- lines.append(' ')
- lines.extend(sourcelines)
- lines.append('')
-
- # Write
- output_filename = os.path.join(OUTPUT_DIR, name + '.rst')
- output_dir = os.path.dirname(output_filename)
- if not os.path.isdir(output_dir):
- os.makedirs(output_dir)
- with open(output_filename, 'w') as f:
- f.write('\n'.join(lines))
- count += 1
- print('Wrote %s examples.' % count)
-
-
-def create_examples_list(examples):
-
- # Create TOC
- lines = []
- lines.append('Full list of examples')
- lines.append('=' * len(lines[-1]))
- lines.append('Check out the `gallery <http://vispy.org/gallery.html>`_ '
- 'to see what some of these demos look like in action.')
- lines.append('')
-
- # Add entry for each example that we know
- for _, name in examples:
- in_gallery = False
- with open(os.path.join(EXAMPLES_DIR, name + '.py')) as f:
- for line in f.readlines():
- line = line.rstrip()
- if line.startswith('# vispy:') and 'gallery' in line:
- in_gallery = True
- if in_gallery:
- extra = ' [`gallery <http://vispy.org/examples/%s.html>`__]' % name
- else:
- extra = ''
- lines.append('* :doc:`examples/%s`%s' % (name, extra))
-
- # Write file
- with open(os.path.join(DOC_DIR, 'examples.rst'), 'w') as f:
- f.write('\n'.join(lines))
-
-
-if __name__ == '__main__':
- main()
diff --git a/doc/ext/glapigenerator.py b/doc/ext/glapigenerator.py
deleted file mode 100644
index 1184ec3..0000000
--- a/doc/ext/glapigenerator.py
+++ /dev/null
@@ -1,62 +0,0 @@
-""" Called from vispy_ext.py to generate the GL API.
-"""
-
-import os
-from vispy.gloo import gl
-
-THISDIR = os.path.dirname(os.path.abspath(__file__))
-DOCSDIR = os.path.join(THISDIR, '..')
-
-
-def clean():
- fname = os.path.join(DOCSDIR, 'gl.rst')
- if os.path.isfile(fname):
- os.remove(fname)
-
-
-def parse_api(ob):
- # Parse the namespace
- const_names = []
- func_names = []
- for name in dir(ob):
- if name.startswith('GL_'):
- const_names.append(name)
- elif name.startswith('gl'):
- func_names.append(name)
- return const_names, func_names
-
-
-def main():
-
- lines = [':orphan:', '']
-
- # Get info
- gl_const_names, gl_func_names = parse_api(gl)
-
- # Write title
- lines.append('OpenGL ES 2.0 API')
- lines.append('=' * len(lines[-1]))
- lines.append('')
-
- # Some info
- lines.append(
- 'The ``vispy.gloo.gl`` namespace provides the OpenGL ES 2.0 API,')
- lines.append('Consisting of %i constants and %i functions ' %
- (len(gl_const_names), len(gl_func_names)))
-
- # Write class header
- lines.append('**vispy.gloo.gl**\n')
-
- # Write constants and functions
- for name in sorted(gl_func_names):
- lines.append(' * %s()' % name)
- for name in sorted(gl_const_names):
- lines.append(' * %s' % name)
-
- # Write file
- with open(os.path.join(DOCSDIR, 'gl.rst'), 'w') as f:
- f.write('\n'.join(lines))
-
-
-if __name__ == '__main__':
- main()
diff --git a/doc/ext/gloooverviewgenerator.py b/doc/ext/gloooverviewgenerator.py
deleted file mode 100644
index 7bee591..0000000
--- a/doc/ext/gloooverviewgenerator.py
+++ /dev/null
@@ -1,95 +0,0 @@
-""" Called from vispy_ext.py to generate the overview section of the
-gloo docs. This section is simply added to gloo.__doc__.
-"""
-
-from vispy import gloo
-
-
-def main():
- gloo.__doc__ += generate_overview_docs()
-
-
-def clean():
- pass
-
-EXCLUDE = ['ColorBuffer', 'DepthBuffer', 'StencilBuffer']
-CLASSES = ['Program', 'VertexBuffer', 'IndexBuffer', 'Texture1D', 'Texture2D', 'Texture3D',
- 'RenderBuffer', 'FrameBuffer']
-
-
-def get_docs_for_class(klass):
- """ Get props and methods for a class.
- """
-
- # Prepare
- baseatts = dir(gloo.GLObject)
- functype = type(gloo.GLObject.delete)
- proptype = type(gloo.GLObject.id)
- props, funcs = set(), set()
-
- for att in sorted(dir(klass)):
- if att.startswith('_') or att.lower() != att:
- continue
- # Get ob and module name
- attob = getattr(klass, att)
- modulename = klass.__module__.split('.')[-1]
- # Get actual klass
- actualklass = klass
- while True:
- tmp = actualklass.__base__
- if att in dir(tmp):
- actualklass = tmp
- else:
- break
- if actualklass == klass:
- modulename = ''
- elif actualklass is gloo.GLObject:
- modulename = gloo.GLObject.__module__.split('.')[-1]
- # Append
- if isinstance(attob, functype):
- funcs.add(' :meth:`~%s.%s.%s`,' % (
- modulename, actualklass.__name__, att))
- elif isinstance(attob, proptype):
- props.add(' :attr:`~%s.%s.%s`,' % (
- modulename, actualklass.__name__, att))
- # Done
- return props, funcs
-
-
-def generate_overview_docs():
- """ Generate the overview section for the gloo docs.
- """
-
- lines = []
- lines.append('Overview of most important GLOO classes')
- lines.append('=' * len(lines[-1]))
- klasseses = [(getattr(gloo, d),) for d in CLASSES]
- for klasses in klasseses:
- # Init line
- line = '*'
- for klass in klasses:
- line += ' :class:`%s`,' % klass.__name__
- line = line[:-1]
- # Get atts for these classes, sort by name, prop/func
- funcs, props = set(), set()
- for klass in klasses:
- props_, funcs_ = get_docs_for_class(klass)
- props.update(props_)
- funcs.update(funcs_)
- # Add props and funcs
- if props:
- line += '\n\n * properties:'
- for item in sorted(props):
- line += item
- if funcs:
- line += '\n\n * methods:'
- for item in sorted(funcs):
- line += item
- # Add line, strip last char
- lines.append(line[:-1])
-
- return '\n'.join(lines)
-
-
-if __name__ == '__main__':
- print(generate_overview_docs())
diff --git a/doc/ext/numpydoc.py b/doc/ext/numpydoc.py
deleted file mode 100644
index fbc26c3..0000000
--- a/doc/ext/numpydoc.py
+++ /dev/null
@@ -1,178 +0,0 @@
-"""
-========
-numpydoc
-========
-
-Sphinx extension that handles docstrings in the Numpy standard format. [1]
-
-It will:
-
-- Convert Parameters etc. sections to field lists.
-- Convert See Also section to a See also entry.
-- Renumber references.
-- Extract the signature from the docstring, if it can't be determined otherwise.
-
-.. [1] http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines#docstring-standard
-
-"""
-
-import os
-import re
-import pydoc
-import sys
-from docscrape_sphinx import get_doc_object, SphinxDocString
-from sphinx.util.compat import Directive
-import inspect
-if sys.version_info > (3,):
- unicode = str
-
-
-def mangle_docstrings(app, what, name, obj, options, lines,
- reference_offset=[0]):
-
- cfg = dict(use_plots=app.config.numpydoc_use_plots,
- show_class_members=app.config.numpydoc_show_class_members)
-
- if what == 'module':
- # Strip top title
- title_re = re.compile(r'^\s*[#*=]{4,}\n[a-z0-9 -]+\n[#*=]{4,}\s*',
- re.I | re.S)
- lines[:] = title_re.sub(u'', u"\n".join(lines)).split(u"\n")
- else:
- doc = get_doc_object(obj, what, u"\n".join(lines), config=cfg)
- lines[:] = unicode(doc).split(u"\n")
-
- if app.config.numpydoc_edit_link and hasattr(obj, '__name__') and \
- obj.__name__:
- if hasattr(obj, '__module__'):
- v = dict(full_name=u"%s.%s" % (obj.__module__, obj.__name__))
- else:
- v = dict(full_name=obj.__name__)
- lines += [u'', u'.. htmlonly::', '']
- lines += [u' %s' % x for x in
- (app.config.numpydoc_edit_link % v).split("\n")]
-
- # replace reference numbers so that there are no duplicates
- references = []
- for line in lines:
- line = line.strip()
- m = re.match(r'^.. \[([a-z0-9_.-])\]', line, re.I)
- if m:
- references.append(m.group(1))
-
- # start renaming from the longest string, to avoid overwriting parts
- references.sort(key=lambda x: -len(x))
- if references:
- for i, line in enumerate(lines):
- for r in references:
- if re.match(r'^\d+$', r):
- new_r = u"R%d" % (reference_offset[0] + int(r))
- else:
- new_r = u"%s%d" % (r, reference_offset[0])
- lines[i] = lines[i].replace(u'[%s]_' % r,
- u'[%s]_' % new_r)
- lines[i] = lines[i].replace(u'.. [%s]' % r,
- u'.. [%s]' % new_r)
-
- reference_offset[0] += len(references)
-
-
-def mangle_signature(app, what, name, obj, options, sig, retann):
- # Do not try to inspect classes that don't define `__init__`
- if (inspect.isclass(obj) and
- (not hasattr(obj, '__init__') or
- 'initializes x; see ' in pydoc.getdoc(obj.__init__))):
- return '', ''
-
- if not (callable(obj) or hasattr(obj, '__argspec_is_invalid_')):
- return
- if not hasattr(obj, '__doc__'):
- return
-
- doc = SphinxDocString(pydoc.getdoc(obj))
- if doc['Signature']:
- sig = re.sub(u"^[^(]*", u"", doc['Signature'])
- return sig, u''
-
-
-def setup(app, get_doc_object_=get_doc_object):
- global get_doc_object
- get_doc_object = get_doc_object_
-
- app.connect('autodoc-process-docstring', mangle_docstrings)
- app.connect('autodoc-process-signature', mangle_signature)
- app.add_config_value('numpydoc_edit_link', None, False)
- app.add_config_value('numpydoc_use_plots', None, False)
- app.add_config_value('numpydoc_show_class_members', True, True)
-
- # Extra mangling domains
- app.add_domain(NumpyPythonDomain)
- app.add_domain(NumpyCDomain)
-
-#------------------------------------------------------------------------------
-# Docstring-mangling domains
-#------------------------------------------------------------------------------
-
-from docutils.statemachine import ViewList
-from sphinx.domains.c import CDomain
-from sphinx.domains.python import PythonDomain
-
-
-class ManglingDomainBase(object):
- directive_mangling_map = {}
-
- def __init__(self, *a, **kw):
- super(ManglingDomainBase, self).__init__(*a, **kw)
- self.wrap_mangling_directives()
-
- def wrap_mangling_directives(self):
- for name, objtype in self.directive_mangling_map.items():
- self.directives[name] = wrap_mangling_directive(
- self.directives[name], objtype)
-
-
-class NumpyPythonDomain(ManglingDomainBase, PythonDomain):
- name = 'np'
- directive_mangling_map = {
- 'function': 'function',
- 'class': 'class',
- 'exception': 'class',
- 'method': 'function',
- 'classmethod': 'function',
- 'staticmethod': 'function',
- 'attribute': 'attribute',
- }
-
-
-class NumpyCDomain(ManglingDomainBase, CDomain):
- name = 'np-c'
- directive_mangling_map = {
- 'function': 'function',
- 'member': 'attribute',
- 'macro': 'function',
- 'type': 'class',
- 'var': 'object',
- }
-
-
-def wrap_mangling_directive(base_directive, objtype):
- class directive(base_directive):
-
- def run(self):
- env = self.state.document.settings.env
-
- name = None
- if self.arguments:
- m = re.match(r'^(.*\s+)?(.*?)(\(.*)?', self.arguments[0])
- name = m.group(2).strip()
-
- if not name:
- name = self.arguments[0]
-
- lines = list(self.content)
- mangle_docstrings(env.app, objtype, name, None, None, lines)
- self.content = ViewList(lines, self.content.parent)
-
- return base_directive.run(self)
-
- return directive
diff --git a/doc/ext/scriptnamemangler.py b/doc/ext/scriptnamemangler.py
deleted file mode 100644
index bb02dc4..0000000
--- a/doc/ext/scriptnamemangler.py
+++ /dev/null
@@ -1,31 +0,0 @@
-"""
-Readthedocs replaces some javascript sources to pull them from their own
-special server. Somehow their docstools.js is incompatibe, breaking
-the search tool of the docs. This hopefully fixes that.
-"""
-
-import os
-import shutil
-
-THISDIR = os.path.abspath(os.path.dirname(__file__))
-HTMLDIR = os.path.join(THISDIR, '..', '_build', 'html')
-
-
-def init():
- pass
-
-
-def clean(app, *args):
- # Rename doctools.js
- shutil.copy(os.path.join(HTMLDIR, '_static', 'doctools.js'),
- os.path.join(HTMLDIR, '_static', 'doctools_.js'))
- # Change reference
- search_html = os.path.join(HTMLDIR, 'search.html')
- text = open(search_html, 'rt').read()
- text = text.replace('/doctools.js', '/doctools_.js')
- open(search_html, 'wt').write(text)
-
-
-def setup(app):
- init()
- app.connect('build-finished', clean)
diff --git a/doc/ext/vispy_ext.py b/doc/ext/vispy_ext.py
deleted file mode 100644
index a7127a0..0000000
--- a/doc/ext/vispy_ext.py
+++ /dev/null
@@ -1,26 +0,0 @@
-""" Invoke various functionality for vispy docs.
-"""
-
-import examplesgenerator
-import glapigenerator
-import gloooverviewgenerator
-
-
-def init():
- print('Generating examples.')
- examplesgenerator.main()
- print('Generating GL API.')
- glapigenerator.main()
- print('Generating gloo overview section.')
- gloooverviewgenerator.main()
-
-
-def clean(app, *args):
- examplesgenerator.clean()
- glapigenerator.clean()
- gloooverviewgenerator.clean()
-
-
-def setup(app):
- init()
- app.connect('build-finished', clean)
diff --git a/doc/geometry.rst b/doc/geometry.rst
deleted file mode 100644
index 2eb6d1a..0000000
--- a/doc/geometry.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-===================
-The geometry module
-===================
-
-.. automodule:: vispy.geometry
- :members:
diff --git a/doc/gloo.rst b/doc/gloo.rst
deleted file mode 100644
index 5d351bb..0000000
--- a/doc/gloo.rst
+++ /dev/null
@@ -1,84 +0,0 @@
-=====================================
-The object oriented OpenGL API (gloo)
-=====================================
-
-.. automodule:: vispy.gloo
-
-
-Base class
-==========
-
-.. autoclass:: vispy.gloo.GLObject
- :members:
-
-
-Program class
-==========================
-
-.. autoclass:: vispy.gloo.Program
- :members:
-
-
-Buffer classes
-==============
-
-.. autoclass:: vispy.gloo.buffer.Buffer
- :members:
-
-.. autoclass:: vispy.gloo.buffer.DataBuffer
- :members:
-
-.. autoclass:: vispy.gloo.VertexBuffer
- :members:
-
-.. autoclass:: vispy.gloo.IndexBuffer
- :members:
-
-
-Texture classes
-===============
-
-.. autoclass:: vispy.gloo.texture.BaseTexture
- :members:
-
-.. autoclass:: vispy.gloo.Texture2D
- :members:
-
-.. autoclass:: vispy.gloo.Texture3D
- :members:
-
-.. autoclass:: vispy.gloo.TextureAtlas
- :members:
-
-
-Classes related to FBO's
-========================
-
-.. autoclass:: vispy.gloo.RenderBuffer
- :members:
-
-.. autoclass:: vispy.gloo.FrameBuffer
- :members:
-
-
-State methods
-=============
-
-.. automodule:: vispy.gloo.wrappers
- :members:
-
-
-The OpenGL context
-==================
-
-.. automodule:: vispy.gloo.context
- :members:
-
-
-vispy.gloo.gl - low level GL API
-================================
-
-Vispy also exposes a (low level) functional GL API.
-
- `vispy.gloo.gl docs <gl.html>`_
-
diff --git a/doc/index.rst b/doc/index.rst
deleted file mode 100644
index c1216a8..0000000
--- a/doc/index.rst
+++ /dev/null
@@ -1,97 +0,0 @@
-Welcome to vispy's documentation!
-=================================
-
-Vispy is a **high-performance interactive 2D/3D data visualization
-library**. Vispy leverages the computational power of modern **Graphics
-Processing Units (GPUs)** through the **OpenGL** library to display very
-large datasets.
-
-.. toctree::
- :maxdepth: 1
-
- index
-
-Overview
-========
-
-Vispy is a young library under heavy development at this time. It
-targets two categories of users:
-
-1. **Users knowing OpenGL**, or willing to learn OpenGL, who want to
- create beautiful and fast interactive 2D/3D visualizations in Python
- as easily as possible.
-2. **Scientists without any knowledge of OpenGL**, who are seeking a
- high-level, high-performance plotting toolkit.
-
-If you're in the first category, you can already start using Vispy.
-Vispy offers a Pythonic, NumPy-aware, user-friendly interface for OpenGL
-ES 2.0 called **gloo**. You can focus on writing your GLSL code (a GPU
-language) instead of dealing with the complicated OpenGL API - Vispy takes
-care of that automatically for you.
-
-If you're in the second category, we're starting to build experimental
-high-level plotting interfaces. Notably, Vispy now ships a very basic
-and experimental OpenGL backend for matplotlib.
-
-
-Getting started
----------------
-
-We are still working on a complete user guide for Vispy. In the meantime, you
-can:
-
- * Check out the `gallery <http://vispy.org/gallery.html>`_
- * Use the ``vispy.plot`` and ``vispy.scene`` interfaces for high-level work
- (WARNING: experimental / developing code)
- * Use the ``vispy.mpl_plot`` experimental OpenGL backend for matplotlib
- * Start learning OpenGL (see below)
- * Write your own visualizations with ``vispy.gloo`` (requires knowing some
- OpenGL/GLSL)
-
-
-Learning the fundamentals of modern OpenGL
-------------------------------------------
-
-Vispy will eventually provide high-level facilities to let scientists create
-high-quality, high-performance plots without any knowledge of OpenGL. In the
-meantime, you can learn more about modern OpenGL in the references below.
-
-Even when Vispy is mature enough, knowing OpenGL will still let you write
-entirely custom interactive visualizations that fully leverage the power of
-GPUs.
-
- * `A tutorial about Vispy <http://ipython-books.github.io/featured-06/>`_, by Cyrille Rossant, published in the `IPython Cookbook <http://ipython-books.github.io/>`_
- * `A tutorial about modern OpenGL and Vispy, by Nicolas Rougier <http://www.loria.fr/~rougier/teaching/opengl/>`_
- * A paper on the fundamentals behing Vispy: `Rossant C and Harris KD, Hardware-accelerated interactive data visualization for neuroscience in Python, Frontiers in Neuroinformatics 2013 <http://journal.frontiersin.org/Journal/10.3389/fninf.2013.00036/full>`_
- * A free online book on modern OpenGL (but not Python): `Learning Modern 3D Graphics Programming, by Jason L. McKesson <http://www.arcsynthesis.org/gltut/>`_
- * `A PyOpenGL tutorial <http://cyrille.rossant.net/2d-graphics-rendering-tutorial-with-pyopengl/>`_
- * `A tutorial on OpenGL shaders <http://cyrille.rossant.net/shaders-opengl/>`_
-
-
-API reference
-=============
-
-.. toctree::
- :maxdepth: 2
-
- vispy - Top-level tools <vispy>
- vispy.app - Application, event loops, canvas, backends <app>
- vispy.color - Handling colors <color>
- vispy.geometry - Visualization-related geometry routines <geometry>
- vispy.gloo - User-friendly, Pythonic, object-oriented interface to OpenGL <gloo>
- vispy.io - Data IO <io>
- vispy.mpl_plot - OpenGL backend for matplotlib [experimental] <mpl_plot>
- vispy.plot - Vispy native plotting module <plot>
- vispy.scene - The system underlying the upcoming high-level visualization interfaces [experimental] <scene>
- vispy.util - Miscellaneous utilities <util>
-
- examples
- releasenotes
-
-
-Indices and tables
-==================
-
-* :ref:`genindex`
-* :ref:`modindex`
-* :ref:`search`
diff --git a/doc/io.rst b/doc/io.rst
deleted file mode 100644
index 57a42e2..0000000
--- a/doc/io.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-==================
-The data IO module
-==================
-
-.. automodule:: vispy.io
- :members:
diff --git a/doc/make.bat b/doc/make.bat
deleted file mode 100644
index 9cad97b..0000000
--- a/doc/make.bat
+++ /dev/null
@@ -1,190 +0,0 @@
- at ECHO OFF
-
-REM Command file for Sphinx documentation
-
-if "%SPHINXBUILD%" == "" (
- set SPHINXBUILD=sphinx-build
-)
-set BUILDDIR=_build
-set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
-set I18NSPHINXOPTS=%SPHINXOPTS% .
-if NOT "%PAPER%" == "" (
- set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
- set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
-)
-
-if "%1" == "" goto help
-
-if "%1" == "help" (
- :help
- echo.Please use `make ^<target^>` where ^<target^> is one of
- echo. html to make standalone HTML files
- echo. dirhtml to make HTML files named index.html in directories
- echo. singlehtml to make a single large HTML file
- echo. pickle to make pickle files
- echo. json to make JSON files
- echo. htmlhelp to make HTML files and a HTML help project
- echo. qthelp to make HTML files and a qthelp project
- echo. devhelp to make HTML files and a Devhelp project
- echo. epub to make an epub
- echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
- echo. text to make text files
- echo. man to make manual pages
- echo. texinfo to make Texinfo files
- echo. gettext to make PO message catalogs
- echo. changes to make an overview over all changed/added/deprecated items
- echo. linkcheck to check all external links for integrity
- echo. doctest to run all doctests embedded in the documentation if enabled
- goto end
-)
-
-if "%1" == "clean" (
- for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
- del /q /s %BUILDDIR%\*
- goto end
-)
-
-if "%1" == "html" (
- %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/html.
- goto end
-)
-
-if "%1" == "dirhtml" (
- %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
- goto end
-)
-
-if "%1" == "singlehtml" (
- %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
- goto end
-)
-
-if "%1" == "pickle" (
- %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can process the pickle files.
- goto end
-)
-
-if "%1" == "json" (
- %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can process the JSON files.
- goto end
-)
-
-if "%1" == "htmlhelp" (
- %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can run HTML Help Workshop with the ^
-.hhp project file in %BUILDDIR%/htmlhelp.
- goto end
-)
-
-if "%1" == "qthelp" (
- %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; now you can run "qcollectiongenerator" with the ^
-.qhcp project file in %BUILDDIR%/qthelp, like this:
- echo.^> qcollectiongenerator %BUILDDIR%\qthelp\vispy.qhcp
- echo.To view the help file:
- echo.^> assistant -collectionFile %BUILDDIR%\qthelp\vispy.ghc
- goto end
-)
-
-if "%1" == "devhelp" (
- %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished.
- goto end
-)
-
-if "%1" == "epub" (
- %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The epub file is in %BUILDDIR%/epub.
- goto end
-)
-
-if "%1" == "latex" (
- %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
- goto end
-)
-
-if "%1" == "text" (
- %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The text files are in %BUILDDIR%/text.
- goto end
-)
-
-if "%1" == "man" (
- %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The manual pages are in %BUILDDIR%/man.
- goto end
-)
-
-if "%1" == "texinfo" (
- %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
- goto end
-)
-
-if "%1" == "gettext" (
- %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
- if errorlevel 1 exit /b 1
- echo.
- echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
- goto end
-)
-
-if "%1" == "changes" (
- %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
- if errorlevel 1 exit /b 1
- echo.
- echo.The overview file is in %BUILDDIR%/changes.
- goto end
-)
-
-if "%1" == "linkcheck" (
- %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
- if errorlevel 1 exit /b 1
- echo.
- echo.Link check complete; look for any errors in the above output ^
-or in %BUILDDIR%/linkcheck/output.txt.
- goto end
-)
-
-if "%1" == "doctest" (
- %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
- if errorlevel 1 exit /b 1
- echo.
- echo.Testing of doctests in the sources finished, look at the ^
-results in %BUILDDIR%/doctest/output.txt.
- goto end
-)
-
-:end
diff --git a/doc/mpl_plot.rst b/doc/mpl_plot.rst
deleted file mode 100644
index d04e580..0000000
--- a/doc/mpl_plot.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-===================
-The MPL plot module
-===================
-
-.. automodule:: vispy.mpl_plot
- :members:
diff --git a/doc/plot.rst b/doc/plot.rst
deleted file mode 100644
index 0d6cce1..0000000
--- a/doc/plot.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-================================
-The vispy native plotting module
-================================
-
-.. automodule:: vispy.plot
- :members:
diff --git a/doc/releasenotes.rst b/doc/releasenotes.rst
deleted file mode 100644
index 9caa82b..0000000
--- a/doc/releasenotes.rst
+++ /dev/null
@@ -1,44 +0,0 @@
-=============
-Release notes
-=============
-
-**Vispy 0.3**
-
-Many changes:
- * Added multiple new application backends, including a IPython browser
- backend.
- * Experimental support for high-level visualizations through
- '`vispy.scene`` and ``vispy.scene.visuals``.
- * Experimental support for matplotlib plotting through ``vispy.mpl_plot``.
- * Loads of bugfixes.
-
-
-**Vispy 0.2.1**
-
-Small fix in the setup script. The buf prevented pip from working.
-
-
-**Vispy 0.2**
-
-In this release we focussed on improving and finalizing the object
-oriented OpenGL interface ``vispy.gloo``. Some major (backward
-incompatible) changes were done. However, from this release we consider
-the ``vispy.gloo`` package relatively stable and we try to minimize
-backward incompatibilities.
-
-Changes in more detail:
-
- * ``vispy.oogl`` is renamed to ``vispy.gloo``
- * ``vispy.gl`` is moved to ``vispy.gloo.gl`` since most users will
- use gloo to interface with OpenGL.
- * Improved (and thus changed) several parts of the gloo API.
- * Some parts of gloo were refactored and should be more robust.
- * Much better coverage of the test suite.
- * Compatibility with Python 2.6 (Jerome Kieffer)
- * More examples and a gallery on the website to show them off.
-
-
-**Vispy 0.1.0**
-
-First release. We have an initial version of the object oriented interface
-to OpenGL, called `vispy.oogl`.
diff --git a/doc/scene.rst b/doc/scene.rst
deleted file mode 100644
index ad6c63a..0000000
--- a/doc/scene.rst
+++ /dev/null
@@ -1,53 +0,0 @@
-==========
-Scenegraph
-==========
-
-.. automodule:: vispy.scene
- :members:
-
-----
-
-vispy.scene.cameras
--------------------
-.. automodule:: vispy.scene.cameras
- :members:
-
-
-----
-
-vispy.scene.canvas
--------------------
-.. automodule:: vispy.scene.canvas
- :members:
-
-
-----
-
-vispy.scene.node
-----------------
-.. automodule:: vispy.scene.node
- :members:
-
-
-----
-
-vispy.scene.events
-------------------
-.. automodule:: vispy.scene.events
- :members:
-
-
-----
-
-vispy.scene.visuals
--------------------
-.. automodule:: vispy.scene.visuals
- :members:
-
-
-----
-
-vispy.scene.widgets
--------------------
-.. automodule:: vispy.scene.widgets
- :members:
diff --git a/doc/themes/scikit-image/layout.html b/doc/themes/scikit-image/layout.html
deleted file mode 100644
index 750ccc4..0000000
--- a/doc/themes/scikit-image/layout.html
+++ /dev/null
@@ -1,113 +0,0 @@
-{#
- scikit-image/layout.html
- ~~~~~~~~~~~~~~~~~
-
- Sphinx layout template for the scikit-image theme, written by
- Johannes Schönberger.
-
-#}
-
-{%- set url_root = pathto('', 1) %}
-{# XXX necessary? #}
-{%- if url_root == '#' %}{% set url_root = '' %}{% endif %}
-{%- if not embedded and docstitle %}
- {%- set titlesuffix = " — "|safe + docstitle|e %}
-{%- else %}
- {%- set titlesuffix = "" %}
-{%- endif %}
-
-{%- macro script() %}
- <script src="http://code.jquery.com/jquery-latest.js"></script>
- <script src="{{ pathto('_static/', 1) }}js/bootstrap.min.js"></script>
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: '{{ url_root }}',
- VERSION: '{{ release|e }}',
- COLLAPSE_INDEX: false,
- FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}',
- HAS_SOURCE: {{ has_source|lower }}
- };
- </script>
- {%- for scriptfile in script_files %}
- <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
- {%- endfor %}
-{%- endmacro %}
-
-{%- macro css() %}
- <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
- <link href="{{ pathto('_static/', 1) }}css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="{{ pathto('_static/', 1) }}css/custom.css" rel="stylesheet" type="text/css">
- <link href="http://fonts.googleapis.com/css?family=Raleway" rel="stylesheet" type="text/css">
- {%- for cssfile in css_files %}
- <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
- {%- endfor %}
-{%- endmacro %}
-
-<!DOCTYPE html>
-<html lang="en">
-<head>
- {%- block htmltitle %}
- <title>{{ title|striptags|e }}{{ titlesuffix }}</title>
- {%- endblock %}
- {{ metatags }}
- {{ css() }}
- {{ script() }}
- {%- if hasdoc('about') %}
- <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
- {%- endif %}
- {%- if hasdoc('genindex') %}
- <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
- {%- endif %}
- {%- if hasdoc('search') %}
- <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
- {%- endif %}
- {%- if hasdoc('copyright') %}
- <link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
- {%- endif %}
- <link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}" />
- {%- if parents %}
- <link rel="up" title="{{ parents[-1].title|striptags|e }}" href="{{ parents[-1].link|e }}" />
- {%- endif %}
- {%- if next %}
- <link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
- {%- endif %}
- {%- if prev %}
- <link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
- {%- endif %}
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
- <link rel="shortcut icon" href="{{ pathto('_static/', 1) }}favicon.ico">
- {%- block extrahead %}{% endblock %}
-</head>
-<body class="container">
- <a href="http://vispy.org" class="logo"><img src="http://vispy.org/_static/img/logo.png" alt=""></a>
- <div class="clearfix"></div>
- <div class="navbar">
- <div class="navbar-inner">
- <ul class="nav">
- {% include 'navbar.html' %}
- </ul>
- <form class="navbar-form pull-right" action="{{ pathto('search') }}" method="get">
- <input type="text" class="search span3" name="q" placeholder="Search documentation ...">
- <input type="hidden" name="check_keywords" value="yes" >
- <input type="hidden" name="area" value="default" >
- </form>
- </div>
- </div>
- <div class="row">
- <div class="span9">
- {% block body %}{% endblock %}
- </div>
- <div class="span3">
- {%- for sidebartemplate in sidebars %}
- {%- include sidebartemplate %}
- {%- endfor %}
- </div>
- </div>
- <div class="well footer">
- <small>
- © Copyright the scikit-image development team.
- Created using <a href="http://twitter.github.com/bootstrap/">Bootstrap</a> and <a href="http://sphinx.pocoo.org/">Sphinx</a>.
- </small>
- </div>
-</body>
-</html>
diff --git a/doc/themes/scikit-image/search.html b/doc/themes/scikit-image/search.html
deleted file mode 100644
index 89464ab..0000000
--- a/doc/themes/scikit-image/search.html
+++ /dev/null
@@ -1,59 +0,0 @@
-{#
- basic/search.html
- ~~~~~~~~~~~~~~~~~
-
- Template for the search page.
-
- :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
- :license: BSD, see LICENSE for details.
-#}
-{% extends "layout.html" %}
-{% set title = _('Search') %}
-{% set script_files = script_files + ['_static/searchtools.js'] %}
-{% block extrahead %}
- <script type="text/javascript">
- jQuery(function() { Search.loadIndex("{{ pathto('searchindex.js', 1) }}"); });
- </script>
- {# this is used when loading the search index using $.ajax fails,
- such as on Chrome for documents on localhost #}
- <script type="text/javascript" id="searchindexloader"></script>
- {{ super() }}
-{% endblock %}
-{% block body %}
- <h1 id="search-documentation">{{ _('Search') }}</h1>
- <div id="fallback" class="admonition warning">
- <script type="text/javascript">$('#fallback').hide();</script>
- <p>
- {% trans %}Please activate JavaScript to enable the search
- functionality.{% endtrans %}
- </p>
- </div>
- <p>
- {% trans %}From here you can search these documents. Enter your search
- words into the box below and click "search". Note that the search
- function will automatically search for all of the words. Pages
- containing fewer words won't appear in the result list.{% endtrans %}
- </p>
- <form action="" method="get">
- <input type="text" name="q" value="" />
- <input type="submit" value="{{ _('search') }}" />
- <span id="search-progress" style="padding-left: 10px"></span>
- </form>
- {% if search_performed %}
- <h2>{{ _('Search Results') }}</h2>
- {% if not search_results %}
- <p>{{ _('Your search did not match any results.') }}</p>
- {% endif %}
- {% endif %}
- <div id="search-results">
- {% if search_results %}
- <ul>
- {% for href, caption, context in search_results %}
- <li><a href="{{ pathto(item.href) }}">{{ caption }}</a>
- <div class="context">{{ context|e }}</div>
- </li>
- {% endfor %}
- </ul>
- {% endif %}
- </div>
-{% endblock %}
diff --git a/doc/themes/scikit-image/static/css/bootstrap-responsive.min.css b/doc/themes/scikit-image/static/css/bootstrap-responsive.min.css
deleted file mode 100644
index 7b0158d..0000000
--- a/doc/themes/scikit-image/static/css/bootstrap-responsive.min.css
+++ /dev/null
@@ -1,9 +0,0 @@
-/*!
- * Bootstrap Responsive v2.1.1
- *
- * Copyright 2012 Twitter, Inc
- * Licensed under the Apache License v2.0
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
- */.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.hidden{display:none;visibility:hidden}.visible-phone{display:none!important}.visible-tablet{display:none!important}.hidden-desktop{displa [...]
diff --git a/doc/themes/scikit-image/static/css/bootstrap.min.css b/doc/themes/scikit-image/static/css/bootstrap.min.css
deleted file mode 100644
index 31d8b96..0000000
--- a/doc/themes/scikit-image/static/css/bootstrap.min.css
+++ /dev/null
@@ -1,9 +0,0 @@
-/*!
- * Bootstrap v2.1.1
- *
- * Copyright 2012 Twitter, Inc
- * Licensed under the Apache License v2.0
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Designed and built with all the love in the world @twitter by @mdo and @fat.
- */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}a:hover,a:active{outline:0}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:- [...]
diff --git a/doc/themes/scikit-image/static/css/custom.css b/doc/themes/scikit-image/static/css/custom.css
deleted file mode 100644
index 0a2d313..0000000
--- a/doc/themes/scikit-image/static/css/custom.css
+++ /dev/null
@@ -1,239 +0,0 @@
-body {
- font-family: "Raleway";
-}
-a {
- color: #CE5C00;
-}
-input,
-button,
-select,
-textarea {
- font-family: "Raleway";
-}
-pre {
- font-size: 11px;
-}
-
-h1, h2, h3, h4, h5, h6 {
- clear: left;
-}
-h1 {
- font-size: 30px;
- line-height: 36px;
-}
-h2 {
- font-size: 24px;
- line-height: 30px;
-}
-h3 {
- font-size: 19px;
- line-height: 21px;
-}
-h4 {
- font-size: 17px;
- line-height: 19px;
-}
-h5 {
- font-size: 15px;
- line-height: 17px;
-}
-h6 {
- font-size: 13px;
- line-height: 15px;
-}
-blockquote {
- border-left: 0;
-}
-dt {
- font-weight: normal;
-}
-
-.logo {
- float: left;
- margin: 20px 0 20px 22px;
-}
-.logo img {
- height: 70px;
-}
-
-.hero {
- padding: 10px 25px;
-}
-
-.gallery-random {
- float: right;
- line-height: 180px;
-}
-.gallery-random img {
- max-height: 180px;
-}
-
-.coins-sample {
- padding: 5px;
-}
-
-.sidebar-box {
- padding: 0;
-}
-.sidebar-box-heading {
- padding-left: 15px;
-}
-
-#current {
- font-weight: bold;
-}
-
-.headerlink {
- margin-left: 10px;
- color: #ddd;
- display: none;
-}
-h1:hover .headerlink,
-h2:hover .headerlink,
-h3:hover .headerlink,
-h4:hover .headerlink,
-h5:hover .headerlink,
-h6:hover .headerlink {
- display: inline;
-}
-.headerlink:hover {
- color: #CE5C00;
- text-decoration: none;
-}
-
-.footer {
- margin-top: 30px;
- padding: 5px 10px;
- color: #999;
-}
-.footer a {
- color: #999;
- text-decoration: underline;
-}
-
-.ohloh-use, .gplus-use {
- float: left;
- margin: 0 0 10px 15px;
-}
-
-/* Documentation */
-
-/* general table settings */
-table.docutils {
- margin-bottom: 10px;
- border-color: #ccc;
-}
-table.docutils td, table.docutils th {
- padding: 5px;
- border-color: #ccc;
- text-align: left;
-}
-
-.toc ul ul {
- font-size: 13px;
- margin-right: -15px;
-}
-
-/* master content table */
-.contentstable.docutils, .contentstable.docutils td {
- border-color: transparent;
-}
-.contentstable.docutils .first {
- font-weight: bold;
-}
-.contentstable.docutils .last {
- padding-left: 10px;
-}
-
-.docutils .label, .docutils .badge {
- background: transparent;
- text-shadow: none;
- font-size: 13px;
- padding: 5px;
- line-height: 20px;
- color: #333;
-}
-
-/* module summary table */
-.longtable.docutils {
- font-size: 12px;
- margin-bottom: 30px;
-}
-.longtable.docutils, .longtable.docutils td {
- border-color: #ccc;
-}
-
-/* function and class description */
-dl.class, dl.function, dl.method, dl.attribute {
- border-top: 1px solid #ccc;
- padding-top: 10px;
-}
-.descclassname {
- color: #aaa;
- font-weight: normal;
- font-family: monospace;
-}
-.descname {
- font-family: monospace;
-}
-dl.class em, dl.function em, dl.class big, dl.function big {
- font-weight: normal;
- font-family: monospace;
-}
-dl.class dd, dl.function dd {
- padding: 10px;
-}
-.docutils.field-list th {
- background-color: #eee;
- padding: 10px;
- text-align: left;
- vertical-align: top;
- width: 100px;
-}
-.docutils.field-list td {
- padding: 10px 10px 10px 20px;
- text-align: left;
- vertical-align: top;
-}
-.docutils.field-list td blockquote p {
- font-size: 13px;
- line-height: 18px;
-}
-p.rubric {
- font-weight: bold;
- font-size: 19px;
- margin: 15px 0 10px 0;
-}
-p.admonition-title {
- font-weight: bold;
- text-decoration: underline;
-}
-
-/* example gallery */
-
-.gallery {
- height: 200px;
-}
-
-.figure {
- float: left;
- margin: 1em;
-}
-
-.figure img {
- display: block;
- margin-left: auto;
- margin-right: auto;
- max-height: 150px;
- max-width: 200px;
-}
-
-.figure .caption {
- width: 200px;
- text-align: center !important;
-}
-
-/* misc */
-div.math {
- text-align: center;
-}
diff --git a/doc/themes/scikit-image/static/img/favicon.ico b/doc/themes/scikit-image/static/img/favicon.ico
deleted file mode 100644
index d7ae601..0000000
Binary files a/doc/themes/scikit-image/static/img/favicon.ico and /dev/null differ
diff --git a/doc/themes/scikit-image/static/img/glyphicons-halflings-white.png b/doc/themes/scikit-image/static/img/glyphicons-halflings-white.png
deleted file mode 100644
index 3bf6484..0000000
Binary files a/doc/themes/scikit-image/static/img/glyphicons-halflings-white.png and /dev/null differ
diff --git a/doc/themes/scikit-image/static/img/glyphicons-halflings.png b/doc/themes/scikit-image/static/img/glyphicons-halflings.png
deleted file mode 100644
index a996999..0000000
Binary files a/doc/themes/scikit-image/static/img/glyphicons-halflings.png and /dev/null differ
diff --git a/doc/themes/scikit-image/static/js/bootstrap.min.js b/doc/themes/scikit-image/static/js/bootstrap.min.js
deleted file mode 100644
index 0e33fb1..0000000
--- a/doc/themes/scikit-image/static/js/bootstrap.min.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/*!
-* Bootstrap.js by @fat & @mdo
-* Copyright 2012 Twitter, Inc.
-* http://www.apache.org/licenses/LICENSE-2.0.txt
-*/
-!function(e){e(function(){"use strict";e.support.transition=function(){var e=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==undefined)return t[n]}();return e&&{end:e}}()})}(window.jQuery),!function(e){"use strict";var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=funct [...]
\ No newline at end of file
diff --git a/doc/themes/scikit-image/theme.conf b/doc/themes/scikit-image/theme.conf
deleted file mode 100644
index f83ec96..0000000
--- a/doc/themes/scikit-image/theme.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-[theme]
-inherit = basic
-stylesheet = none
-pygments_style = default
diff --git a/doc/user_guide.md b/doc/user_guide.md
deleted file mode 100644
index b982063..0000000
--- a/doc/user_guide.md
+++ /dev/null
@@ -1,329 +0,0 @@
-# VisPy user guide
-
-Welcome to the VisPy user guide!
-
-## Introduction to VisPy
-
-VisPy aims at offering high-quality, high-performance scientific visualization facilities in Python. In development since 2013, VisPy represents a joint effort of four developers who had independently worked on OpenGL-based visualization libraries. With the low-level foundations being layed out, the plotting API of VisPy is now usable by all scientists. No knowledge of OpenGL is required for most plotting use-cases.
-
-There are three levels with which VisPy can be used:
-
-* 3. **Scientific plotting interface**: most use-cases
-* 2. **Scene graph**: advanced use-cases
-* 1. **Pythonic OpenGL (gloo)**: optimal performance on highly-specific use-cases
-
-Level 3 is implemented on top of level 2 which is itself implemented on top of level 1.
-
-
-## Interactive scientific plots
-
-Several common plotting functions are available in `vispy.plot`. The plotting interface is still in extensive development and the API might be subject to changes in future versions.
-
-### Line plot
-
-TODO
-
-```python
-import vispy.plot as vp
-vp.plot(x, y)
-```
-
-### Scatter plot
-
-TODO
-
-
-### Images
-
-TODO
-
-
-### Surface plot
-
-TODO
-
-
-### matplotlib and VisPy
-
-There is an experimental matplotlib-to-VisPy converter in `vispy.mpl_plot`.
-
-```python
-import vispy.mpl_plot as plt
-plt.plot(x, y) # this is a normal matplotlib API call
-plt.draw() # replace the normal matplotlib plt.show() by this
-```
-
-It still doesn't work in all cases, but eventually it will.
-
-
-## The scene graph
-
-The scene graph targets users who have more advanced needs than what `vispy.plot` provides. The scene graph is a dynamic graph where nodes are visual elements, and edges represent relative transformations. The scene graph therefore encodes the positions of all visual elements in the scene.
-
-TODO
-
-### Displaying an empty window
-
-* Changing the background color
-
-
-### Displaying visuals
-
-
-
-### Handling transforms
-
-
-## Pythonic OpenGL (gloo)
-
-OpenGL is a low-level graphics API that gives access to the **Graphics Processing Unit (GPU)** for high-performance real-time 2D/3D visualization. It is a complex API, but VisPy implements a user-friendly and Pythonic interface that makes it considerably easier to use OpenGL.
-
-### Creating a window
-
-First, let's see how to create a window:
-
-```python
-from vispy import app, gloo
-
-# Create a canvas with common key bindings for interactive use.
-canvas = app.Canvas(keys='interactive')
-
-# Use this decorator to register event handlers.
- at canvas.connect
-def on_draw(event):
- # The window needs to be cleared at every draw.
- gloo.clear('deepskyblue')
-
-canvas.show()
-app.run() # Not necessary in interactive mode.
-```
-
-
-### Event handlers
-
-Here are the main events. Every function accepts an `event` object as argument. The attributes of this object depend on the event, you will find them in the API documentation.
-
-* `on_resize`: when the window is resized. Use-cases: set the viewport, reorganize the layout of the visuals.
-* `on_draw`: when the scene is drawn.
-* `on_mouse_press`: when the mouse is pressed. Attributes:
- * `event.buttons`: list of pressed buttons (1, 2, or 3)
- * `events.pos` (in window coordinates)
-* `on_mouse_release`: when the mouse is released after it has been pressed.
-* `on_mouse_move`: when the mouse moves. The `event.is_dragging` attribute can be used to handle drag and drop events.
-* `on_mouse_wheel`: when the mouse wheel changes. Attributes:
- * `event.delta[1]`: amount of scroll in the vertical direction.
-* `on_key_press`: when a key is pressed. Attributes:
- * `event.key`: `Key` instance.
- * `event.text`: string with the key pressed.
-* `on_key_release`: when a key is released.
-
-Here is an example:
-
-```python
-import numpy as np
-from vispy import app, gloo
-
-canvas = app.Canvas(keys='interactive')
-
- at canvas.connect
-def on_mouse_move(event):
- x, y = event.pos # Position of the cursor in window coordinates.
- w, h = canvas.size # Size of the window (in pixels).
-
- # We update the background color when the mouse moves.
- r, b = np.clip([x / float(w), y / float(h)], 0, 1)
- gloo.clear((r, 0.0, b, 1.0))
-
- # This is used to refresh the window and trigger a draw event.
- canvas.update()
-
-canvas.show()
-app.run()
-```
-
-### Introduction to the rendering pipeline
-
-Now that we can display windows, let's get started with OpenGL.
-
-> This paragraph comes mostly from the [IPython Cookbook](https://ipython-books.github.io/featured-06/).
-
-The **rendering pipeline** defines how data is processed on the GPU for rendering.
-
-There are four major elements in the rendering pipeline of a given OpenGL program:
-
-* **Data buffers** store numerical data on the GPU. The main types of buffers are **vertex buffers**, **index buffers**, and **textures**.
-
-* **Variables** are available in the shaders. There are four major types of variables: **attributes**, **uniforms**, **varyings**, and **texture samplers**.
-
-* **Shaders** are GPU programs written in a C-like language called OpenGL Shading Language (GLSL). The two main types of shaders are **vertex shaders** and **fragment shaders**.
-
-* The **primitive type** defines the way data points are rendered. The main types are **points**, **lines*, and **triangles**.
-
-Here is how the rendering pipeline works:
-
-1. Data is sent on the GPU and stored in buffers.
-2. The vertex shader processes the data in parallel and generates a number of 4D points in a normalized coordinate system (+/-1, +/-1). The fourth dimension is a homogeneous coordinate (generally 1).
-3. Graphics primitives are generated from the data points returned by the vertex shader (primitive assembly and rasterization).
-4. The fragment shader processes all primitive pixels in parallel and returns each pixel's color as RGBA components.
-
-In `vispy.gloo`, a Program is created with the vertex and fragment shaders. Then, the variables declared in the shaders can be set with the syntax `program['varname'] = value`. When `varname` is an attribute variable, the value can just be a NumPy 2D array. In this array, every line contains the components of every data point.
-
-Similarly, we could declare and set uniforms and textures in our program.
-
-Finally, `program.draw()` renders the data using the specified primitive type (point, line, or triangle).
-
-In addition, an index buffer may be provided. An index buffer contains indices pointing to the vertex buffers. Using an index buffer would allow us to reuse any vertex multiple times during the primitive assembly stage. For example, when rendering a cube with a triangles primitive type (one triangle is generated for every triplet of points), we could use a vertex buffer with 8 data points and an index buffer with 36 indices (3 points per triangle, 2 triangles per face, 6 faces).
-
-
-### First GLSL shaders
-
-Let's now write our first shaders. We will just display points in two dimensions. We will need the following components:
-
-* A `(n, 2)` NumPy array with the 2D positions of the `n` points.
-* A simple vertex shader performing no transformation at all on the point coordinates.
-* A simple fragment shader returning a constant pixel color.
-
-There is one attribute variable `a_position`. This `vec2` variable encodes the (x, y) coordinates of every point.
-
-```python
-from vispy import app, gloo
-import numpy as np
-
-vertex_shader = """
-attribute vec2 a_position;
-void main() {
- // gl_Position is the special return value of the vertex shader.
- // It is a vec4, so here we convert the vec2 position into
- // a vec4. We set the third component to 0 because we're in 2D, and the
- // fourth one to 1 (we don't need homogeneous coordinates here).
- gl_Position = vec4(a_position, 0.0, 1.0);
-
- // This is the size of the displayed points.
- gl_PointSize = 1.0;
-}
-"""
-
-fragment_shader = """
-void main() {
- // gl_FragColor is the special return value of the fragment shader.
- // It is a vec4 with rgba components. Here we just return the color blue.
- gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
-}
-"""
-
-# We create an OpenGL program with the vertex and fragment shader.
-program = gloo.Program(vertex_shader, fragment_shader)
-
-# We generate the x, y coordinates of the points.
-position = .25 * np.random.randn(100000, 2)
-
-# We set the a_position attribute to the position NumPy array.
-# Every row in the array is one vertex. The vertex shader is called once per
-# vertex, so once per row.
-# WARNING: most GPUs only support float32 data (not float64).
-program['a_position'] = position.astype(np.float32)
-
-# We create a ccanvas.
-canvas = app.Canvas(keys='interactive')
-
-# We update the viewport when the window is resized.
- at canvas.connect
-def on_resize(event):
- width, height = event.size
- gloo.set_viewport(0, 0, width, height)
-
- at canvas.connect
-def on_draw(event):
- # We clear the window.
- gloo.clear('white')
-
- # We render the program with the 'points' mode. Every vertex is
- # rendered as a point.
- program.draw('points')
-
-canvas.show()
-app.run()
-```
-
-
-### GPU-based animations in GLSL
-
-For optimal performance, interactivity and animations should be implemented on the GPU. Vertex positions can be updated in real-time on the GPU, which is used for panning and zooming for example. This is optimal because vertices are all processed in parallel on the GPU. Also, the fragment shader can be used for ray tracing, fractals, and volume rendering.
-
-Here is a simple example where an animation is implemented on the GPU:
-
-```python
-from vispy import app, gloo
-import numpy as np
-
-# We manually tesselate an horizontal rectangle. We will use triangle strips.
-n = 100
-position = np.zeros((2*n, 2)).astype(np.float32)
-position[:,0] = np.repeat(np.linspace(-1, 1, n), 2)
-position[::2,1] = -.2
-position[1::2,1] = .2
-color = np.linspace(0., 1., 2 * n).astype(np.float32)
-
-vertex_shader = """
-const float M_PI = 3.14159265358979323846;
-
-attribute vec2 a_position;
-attribute float a_color;
-
-// Varyings are used to passed values from the vertex shader to the fragment
-// shader. The value at one pixel in the fragment shader is interpolated
-// from the values at the neighboring pixels.
-varying float v_color;
-uniform float u_time;
-
-void main (void) {
- // We implement the animation in the y coordinate.
- float x = a_position.x;
- float y = a_position.y + .1 * cos(2.0*M_PI*(u_time-.5*x));
- gl_Position = vec4(x, y, 0.0, 1.0);
-
- // We pass the color to the fragment shader.
- v_color = a_color;
-}
-"""
-
-fragment_shader = """
-uniform float u_time;
-varying float v_color;
-void main()
-{
- gl_FragColor = vec4(1.0, v_color, 0.0, 1.0);
-}
-"""
-
-# This is an alternative way to create a canvas: deriving from app.Canvas.
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
- self.program = gloo.Program(vertex_shader, fragment_shader)
- self.program['a_position'] = gloo.VertexBuffer(position)
- self.program['a_color'] = gloo.VertexBuffer(color)
- self.program['u_time'] = 0.
-
- # We create a timer for the animation.
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- def on_resize(self, event):
- width, height = event.size
- gloo.set_viewport(0, 0, width, height)
-
- def on_draw(self, event):
- gloo.clear(color=(0.0, 0.0, 0.0, 1.0))
- self.program.draw('triangle_strip')
-
- def on_timer(self, event):
- # We update theu_time uniform at every iteration.
- self.program['u_time'] = event.iteration * 1. / 60
-
- # This is used to refresh the window and trigger a draw event.
- self.update()
-
-canvas = Canvas()
-canvas.show()
-app.run()
-```
diff --git a/doc/util.rst b/doc/util.rst
deleted file mode 100644
index 6f85c00..0000000
--- a/doc/util.rst
+++ /dev/null
@@ -1,60 +0,0 @@
-===============
-The util module
-===============
-
-.. automodule:: vispy.util
-
-
-----
-
-vispy.util.event
-----------------
-.. automodule:: vispy.util.event
-
-----
-
-.. autoclass:: vispy.util.event.Event
- :members:
-
-.. autoclass:: vispy.app.canvas.MouseEvent
- :members:
-
-.. autoclass:: vispy.app.canvas.KeyEvent
- :members:
-
-.. autoclass:: vispy.app.canvas.ResizeEvent
- :members:
-
-.. autoclass:: vispy.app.canvas.DrawEvent
- :members:
-
-----
-
-.. autoclass:: vispy.util.event.EventEmitter
- :members:
-
- .. automethod:: vispy.util.event.EventEmitter.__call__
-
-
-----
-
-vispy.util.fonts
-----------------
-.. automodule:: vispy.util.fonts
- :members:
-
-
-----
-
-vispy.util.keys
----------------
-.. automodule:: vispy.util.keys
- :members:
-
-
-----
-
-vispy.util.transforms
----------------------
-.. automodule:: vispy.util.transforms
- :members:
diff --git a/doc/vispy.rst b/doc/vispy.rst
deleted file mode 100644
index cc073d2..0000000
--- a/doc/vispy.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-=====
-Vispy
-=====
-
-.. automodule:: vispy
- :members:
diff --git a/examples/basics/gloo/animate_images.py b/examples/basics/gloo/animate_images.py
deleted file mode 100644
index a0f0bc2..0000000
--- a/examples/basics/gloo/animate_images.py
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 2
-"""
-Example demonstrating showing a, image with a fixed ratio.
-"""
-
-import numpy as np
-
-from vispy.util.transforms import ortho
-from vispy import gloo
-from vispy import app
-
-
-# Image to be displayed
-W, H = 64, 48
-I = np.random.uniform(0, 1, (W, H)).astype(np.float32)
-
-# A simple texture quad
-data = np.zeros(4, dtype=[('a_position', np.float32, 2),
- ('a_texcoord', np.float32, 2)])
-data['a_position'] = np.array([[0, 0], [W, 0], [0, H], [W, H]])
-data['a_texcoord'] = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
-
-
-VERT_SHADER = """
-// Uniforms
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform float u_antialias;
-
-// Attributes
-attribute vec2 a_position;
-attribute vec2 a_texcoord;
-
-// Varyings
-varying vec2 v_texcoord;
-
-// Main
-void main (void)
-{
- v_texcoord = a_texcoord;
- gl_Position = u_projection * u_view * u_model * vec4(a_position,0.0,1.0);
-}
-"""
-
-FRAG_SHADER = """
-uniform sampler2D u_texture;
-varying vec2 v_texcoord;
-void main()
-{
- gl_FragColor = texture2D(u_texture, v_texcoord);
- gl_FragColor.a = 1.0;
-}
-
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=((W * 5), (H * 5)))
-
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- self.texture = gloo.Texture2D(I, interpolation='linear')
-
- self.program['u_texture'] = self.texture
- self.program.bind(gloo.VertexBuffer(data))
-
- self.view = np.eye(4, dtype=np.float32)
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
-
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
- self.projection = ortho(0, W, 0, H, -1, 1)
- self.program['u_projection'] = self.projection
-
- gloo.set_clear_color('white')
-
- self._timer = app.Timer('auto', connect=self.update, start=True)
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
- self.projection = ortho(0, width, 0, height, -100, 100)
- self.program['u_projection'] = self.projection
-
- # Compute thje new size of the quad
- r = width / float(height)
- R = W / float(H)
- if r < R:
- w, h = width, width / R
- x, y = 0, int((height - h) / 2)
- else:
- w, h = height * R, height
- x, y = int((width - w) / 2), 0
- data['a_position'] = np.array(
- [[x, y], [x + w, y], [x, y + h], [x + w, y + h]])
- self.program.bind(gloo.VertexBuffer(data))
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
- I[...] = np.random.uniform(0, 1, (W, H)).astype(np.float32)
- self.texture.set_data(I)
- self.program.draw('triangle_strip')
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/basics/gloo/animate_images_slice.py b/examples/basics/gloo/animate_images_slice.py
deleted file mode 100644
index edbded6..0000000
--- a/examples/basics/gloo/animate_images_slice.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# author: Irwin Zaid
-# vispy: gallery 2
-
-"""
-Example demonstrating a 3D Texture. The volume contains noise that
-is smoothed in the z-direction. Shown is one slice throught that volume
-to give the effect of "morphing" noise.
-"""
-
-import numpy as np
-
-from vispy.util.transforms import ortho
-from vispy import gloo
-from vispy import app
-from vispy.visuals.shaders import ModularProgram
-
-
-# Shape of image to be displayed
-D, H, W = 30, 60, 90
-
-# Modulated image
-I = np.random.uniform(0, 0.1, (D, H, W, 3)).astype(np.float32)
-# Depth slices are dark->light
-I[...] += np.linspace(0, 0.9, D)[:, np.newaxis, np.newaxis, np.newaxis]
-# Make vertical direction more green moving upward
-I[..., 1] *= np.linspace(0, 1, H)[np.newaxis, :, np.newaxis]
-# Make horizontal direction more red moving rightward
-I[..., 0] *= np.linspace(0, 1, W)[np.newaxis, np.newaxis, :]
-
-# A simple texture quad
-data = np.zeros(4, dtype=[('a_position', np.float32, 2),
- ('a_texcoord', np.float32, 2)])
-data['a_position'] = np.array([[0, 0], [W, 0], [0, H], [W, H]])
-data['a_texcoord'] = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
-
-
-VERT_SHADER = """
-// Uniforms
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-
-// Attributes
-attribute vec2 a_position;
-attribute vec2 a_texcoord;
-
-// Varyings
-varying vec2 v_texcoord;
-
-// Main
-void main (void)
-{
- v_texcoord = a_texcoord;
- gl_Position = u_projection * u_view * u_model * vec4(a_position,0.0,1.0);
-}
-"""
-
-FRAG_SHADER = """
-uniform $sampler_type u_texture;
-uniform float i;
-varying vec2 v_texcoord;
-void main()
-{
- // step through gradient with i, note that slice (depth) comes last here!
- gl_FragColor = $sample(u_texture, vec3(v_texcoord, i));
- gl_FragColor.a = 1.0;
-}
-
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self, emulate3d=True):
- app.Canvas.__init__(self, keys='interactive', size=((W*5), (H*5)))
-
- if emulate3d:
- tex_cls = gloo.TextureEmulated3D
- else:
- tex_cls = gloo.Texture3D
- self.texture = tex_cls(I, interpolation='nearest',
- wrapping='clamp_to_edge')
-
- self.program = ModularProgram(VERT_SHADER, FRAG_SHADER)
- self.program.frag['sampler_type'] = self.texture.glsl_sampler_type
- self.program.frag['sample'] = self.texture.glsl_sample
- self.program['u_texture'] = self.texture
- self.program['i'] = 0.0
- self.program.bind(gloo.VertexBuffer(data))
-
- self.view = np.eye(4, dtype=np.float32)
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
-
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
- self.projection = ortho(0, W, 0, H, -1, 1)
- self.program['u_projection'] = self.projection
-
- self.i = 0
-
- gloo.set_clear_color('white')
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
- self.projection = ortho(0, width, 0, height, -100, 100)
- self.program['u_projection'] = self.projection
-
- # Compute the new size of the quad
- r = width / float(height)
- R = W / float(H)
- if r < R:
- w, h = width, width / R
- x, y = 0, int((height - h) / 2)
- else:
- w, h = height * R, height
- x, y = int((width - w) / 2), 0
- data['a_position'] = np.array(
- [[x, y], [x + w, y], [x, y + h], [x + w, y + h]])
- self.program.bind(gloo.VertexBuffer(data))
-
- def on_timer(self, event):
- # cycle every 2 sec
- self.i = (self.i + 1./120.) % 1.0
- self.update()
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
- self.program['i'] = 1.9 * np.abs(0.5 - self.i)
- self.program.draw('triangle_strip')
-
-
-if __name__ == '__main__':
- # Use emulated3d to switch from an emulated 3D texture to an actual one
- c = Canvas(emulate3d=True)
- app.run()
diff --git a/examples/basics/gloo/animate_shape.py b/examples/basics/gloo/animate_shape.py
deleted file mode 100644
index 43e2aed..0000000
--- a/examples/basics/gloo/animate_shape.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 3
-
-"""
-Example demonstrating showing a quad. Like hello_quad1.py, but now
-with Texture2D and VertexBuffer, and optionally using an ElementBuffer to
-draw the vertices.
-"""
-
-import time
-import numpy as np
-
-from vispy import gloo
-from vispy import app
-
-
-# Create a texture
-im1 = np.zeros((100, 100, 3), 'float32')
-im1[:50, :, 0] = 1.0
-im1[:, :50, 1] = 1.0
-im1[50:, 50:, 2] = 1.0
-
-# Create vetices and texture coords, combined in one array for high performance
-vertex_data = np.zeros(4, dtype=[('a_position', np.float32, 3),
- ('a_texcoord', np.float32, 2)])
-vertex_data['a_position'] = np.array([[-0.8, -0.8, 0.0], [+0.7, -0.7, 0.0],
- [-0.7, +0.7, 0.0], [+0.8, +0.8, 0.0, ]])
-vertex_data['a_texcoord'] = np.array([[0.0, 0.0], [0.0, 1.0],
- [1.0, 0.0], [1.0, 1.0]])
-
-# Create indices and an ElementBuffer for it
-indices = np.array([0, 1, 2, 1, 2, 3], np.uint16)
-indices_buffer = gloo.IndexBuffer(indices)
-client_indices_buffer = gloo.IndexBuffer(indices)
-
-
-VERT_SHADER = """ // simple vertex shader
-
-attribute vec3 a_position;
-attribute vec2 a_texcoord;
-uniform float sizeFactor;
-
-void main (void) {
- // Pass tex coords
- gl_TexCoord[0] = vec4(a_texcoord.x, a_texcoord.y, 0.0, 0.0);
- // Calculate position
- gl_Position = sizeFactor*vec4(a_position.x, a_position.y, a_position.z,
- 1.0/sizeFactor);
-}
-"""
-
-FRAG_SHADER = """ // simple fragment shader
-uniform sampler2D texture1;
-
-void main()
-{
- gl_FragColor = texture2D(texture1, gl_TexCoord[0].st);
-}
-
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
-
- # Create program
- self._program = gloo.Program(VERT_SHADER, FRAG_SHADER)
-
- # Create vertex buffer
- self._vbo = gloo.VertexBuffer(vertex_data)
-
- # Set uniforms, samplers, attributes
- # We create one VBO with all vertex data (array of structures)
- # and create two views from it for the attributes.
- self._program['texture1'] = gloo.Texture2D(im1)
- self._program.bind(self._vbo) # This does:
- #self._program['a_position'] = self._vbo['a_position']
- #self._program['a_texcoords'] = self._vbo['a_texcoords']
-
- gloo.set_clear_color('white')
-
- self._timer = app.Timer('auto', connect=self.update, start=True)
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- def on_draw(self, event):
-
- # Clear
- gloo.clear()
-
- # Draw
- self._program['sizeFactor'] = 0.5 + np.sin(time.time() * 3) * 0.2
-
- # Draw (pick one!)
- # self._program.draw('triangle_strip')
- self._program.draw('triangles', indices_buffer)
- # self._program.draw('triangles', client_indices_buffer) # Not
- # recommended
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/basics/gloo/display_lines.py b/examples/basics/gloo/display_lines.py
deleted file mode 100644
index 6b4e32a..0000000
--- a/examples/basics/gloo/display_lines.py
+++ /dev/null
@@ -1,129 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 2
-""" Show a bunch of lines.
-This example demonstrates how multiple line-pieces can be drawn
-using one call, by discarting some fragments.
-
-Note that this example uses canvas.context.X() to call gloo functions.
-These functions are also available as vispy.gloo.X(), but apply
-explicitly to the canvas. We still need to decide which we think is the
-preferred API.
-"""
-
-import numpy as np
-from vispy import gloo
-from vispy import app
-from vispy.util.transforms import perspective, translate, rotate
-
-W, H = 400, 400
-
-# Create vertices
-n = 100
-a_position = np.random.uniform(-1, 1, (n, 3)).astype(np.float32)
-a_id = np.random.randint(0, 30, (n, 1))
-a_id = np.sort(a_id, axis=0).astype(np.float32)
-
-
-VERT_SHADER = """
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-attribute vec3 a_position;
-attribute float a_id;
-varying float v_id;
-void main (void) {
- v_id = a_id;
- gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);
-}
-"""
-
-FRAG_SHADER = """
-varying float v_id;
-void main()
-{
- float f = fract(v_id);
- // The second useless test is needed on OSX 10.8 (fuck)
- if( (f > 0.0001) && (f < .9999) )
- discard;
- else
- gl_FragColor = vec4(0,0,0,1);
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- # ---------------------------------
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(W, H))
-
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
-
- # Set uniform and attribute
- self.program['a_id'] = gloo.VertexBuffer(a_id)
- self.program['a_position'] = gloo.VertexBuffer(a_position)
-
- self.translate = 5
- self.view = translate((0, 0, -self.translate), dtype=np.float32)
- self.model = np.eye(4, dtype=np.float32)
-
- gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])
- self.projection = perspective(45.0, self.size[0] /
- float(self.size[1]), 1.0, 1000.0)
- self.program['u_projection'] = self.projection
-
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
-
- self.theta = 0
- self.phi = 0
-
- self.context.set_clear_color('white')
- self.context.set_state('translucent')
-
- self.timer = app.Timer('auto', connect=self.on_timer)
-
- self.show()
-
- # ---------------------------------
- def on_key_press(self, event):
- if event.text == ' ':
- if self.timer.running:
- self.timer.stop()
- else:
- self.timer.start()
-
- # ---------------------------------
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- self.model = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.program['u_model'] = self.model
- self.update()
-
- # ---------------------------------
- def on_resize(self, event):
- gloo.set_viewport(0, 0, event.physical_size[0], event.physical_size[1])
- self.projection = perspective(45.0, event.size[0] /
- float(event.size[1]), 1.0, 1000.0)
- self.program['u_projection'] = self.projection
-
- # ---------------------------------
- def on_mouse_wheel(self, event):
- self.translate += event.delta[1]
- self.translate = max(2, self.translate)
- self.view = translate((0, 0, -self.translate))
- self.program['u_view'] = self.view
- self.update()
-
- # ---------------------------------
- def on_draw(self, event):
- self.context.clear()
- self.program.draw('line_strip')
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/basics/gloo/display_points.py b/examples/basics/gloo/display_points.py
deleted file mode 100644
index 5449de4..0000000
--- a/examples/basics/gloo/display_points.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 2
-""" Simple example plotting 2D points.
-"""
-
-from vispy import gloo
-from vispy import app
-import numpy as np
-
-VERT_SHADER = """
-attribute vec2 a_position;
-attribute vec3 a_color;
-attribute float a_size;
-
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_radius;
-varying float v_linewidth;
-varying float v_antialias;
-
-void main (void) {
- v_radius = a_size;
- v_linewidth = 1.0;
- v_antialias = 1.0;
- v_fg_color = vec4(0.0,0.0,0.0,0.5);
- v_bg_color = vec4(a_color, 1.0);
-
- gl_Position = vec4(a_position, 0.0, 1.0);
- gl_PointSize = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);
-}
-"""
-
-FRAG_SHADER = """
-#version 120
-
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_radius;
-varying float v_linewidth;
-varying float v_antialias;
-void main()
-{
- float size = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);
- float t = v_linewidth/2.0-v_antialias;
- float r = length((gl_PointCoord.xy - vec2(0.5,0.5))*size);
- float d = abs(r - v_radius) - t;
- if( d < 0.0 )
- gl_FragColor = v_fg_color;
- else
- {
- float alpha = d/v_antialias;
- alpha = exp(-alpha*alpha);
- if (r > v_radius)
- gl_FragColor = vec4(v_fg_color.rgb, alpha*v_fg_color.a);
- else
- gl_FragColor = mix(v_bg_color, v_fg_color, alpha);
- }
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
- ps = self.pixel_scale
-
- # Create vertices
- n = 10000
- v_position = 0.25 * np.random.randn(n, 2).astype(np.float32)
- v_color = np.random.uniform(0, 1, (n, 3)).astype(np.float32)
- v_size = np.random.uniform(2*ps, 12*ps, (n, 1)).astype(np.float32)
-
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- # Set uniform and attribute
- self.program['a_color'] = gloo.VertexBuffer(v_color)
- self.program['a_position'] = gloo.VertexBuffer(v_position)
- self.program['a_size'] = gloo.VertexBuffer(v_size)
- gloo.set_state(clear_color='white', blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- self.show()
-
- def on_resize(self, event):
- gloo.set_viewport(0, 0, *event.physical_size)
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
- self.program.draw('points')
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/basics/gloo/display_shape.py b/examples/basics/gloo/display_shape.py
deleted file mode 100644
index 7eb8faf..0000000
--- a/examples/basics/gloo/display_shape.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 2
-
-"""
-Simple example demonstrating showing a quad.
-gloo objects that this example demonstrates: Program.
-"""
-
-from vispy import gloo
-from vispy import app
-import numpy as np
-
-# Create vertices
-vPosition = np.array([[-0.8, -0.8, 0.0], [+0.7, -0.7, 0.0],
- [-0.7, +0.7, 0.0], [+0.8, +0.8, 0.0, ]], np.float32)
-
-
-VERT_SHADER = """ // simple vertex shader
-attribute vec3 a_position;
-void main (void) {
- gl_Position = vec4(a_position, 1.0);
-}
-"""
-
-FRAG_SHADER = """ // simple fragment shader
-uniform vec4 u_color;
-void main()
-{
- gl_FragColor = u_color;
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
-
- # Create program
- self._program = gloo.Program(VERT_SHADER, FRAG_SHADER)
-
- # Set uniform and attribute
- self._program['u_color'] = 0.2, 1.0, 0.4, 1
- self._program['a_position'] = gloo.VertexBuffer(vPosition)
-
- gloo.set_clear_color('white')
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- def on_draw(self, event):
- gloo.clear()
- self._program.draw('triangle_strip')
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/basics/gloo/gpuimage.py b/examples/basics/gloo/gpuimage.py
deleted file mode 100644
index 025f3cc..0000000
--- a/examples/basics/gloo/gpuimage.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# vispy: gallery 100
-"""
-Illustrate how to plot a 2D function (an image) y=f(x,y) on the GPU.
-"""
-
-from vispy import app, gloo
-
-vertex = """
-attribute vec2 a_position;
-varying vec2 v_position;
-void main()
-{
- gl_Position = vec4(a_position, 0.0, 1.0);
- v_position = a_position;
-}
-"""
-
-fragment = """
-#include "math/constants.glsl"
-//const float M_PI = 3.14159265358979323846;
-uniform float u_time;
-varying vec2 v_position;
-
-/**********************************************************
-Specify the parameters here.
-**********************************************************/
-const float z_offset = 1.; // (z+z_offset)/z_max should be in [0,1]
-const float z_max = 2.;
-const float x_scale = 5.; // x is between -x_scale and +x_scale
-const float y_scale = 5.; // y is between -y_scale and +y_scale
-const float t_scale = 5.; // scale for the time
-/*********************************************************/
-
-float f(float x, float y, float t) {
-
- // x is in [-x_scale, +x_scale]
- // y is in [-y_scale, +y_scale]
- // t is in [0, +oo)
-
- /**********************************************************
- Write your function below.
- **********************************************************/
-
- float k = .25*cos(t);
- return (cos(x)+k)*(sin(y)-k);
-
- /*********************************************************/
-
-}
-
-vec4 jet(float x) {
- vec3 a, b;
- float c;
- if (x < 0.34) {
- a = vec3(0, 0, 0.5);
- b = vec3(0, 0.8, 0.95);
- c = (x - 0.0) / (0.34 - 0.0);
- } else if (x < 0.64) {
- a = vec3(0, 0.8, 0.95);
- b = vec3(0.85, 1, 0.04);
- c = (x - 0.34) / (0.64 - 0.34);
- } else if (x < 0.89) {
- a = vec3(0.85, 1, 0.04);
- b = vec3(0.96, 0.7, 0);
- c = (x - 0.64) / (0.89 - 0.64);
- } else {
- a = vec3(0.96, 0.7, 0);
- b = vec3(0.5, 0, 0);
- c = (x - 0.89) / (1.0 - 0.89);
- }
- return vec4(mix(a, b, c), 1.0);
-}
-
-void main() {
- vec2 pos = v_position;
- float z = f(x_scale * pos.x, y_scale * pos.y, t_scale * u_time);
- gl_FragColor = jet((z + z_offset) / (z_max));
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, position=(300, 100),
- size=(800, 800), keys='interactive')
-
- self.program = gloo.Program(vertex, fragment)
- self.program['a_position'] = [(-1., -1.), (-1., +1.),
- (+1., -1.), (+1., +1.)]
-
- self.program['u_time'] = 0.0
- self.timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def on_timer(self, event):
- self.program['u_time'] = event.elapsed
- self.update()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- def on_draw(self, event):
- self.program.draw('triangle_strip')
-
-if __name__ == '__main__':
- canvas = Canvas()
- app.run()
diff --git a/examples/basics/gloo/hello_fbo.py b/examples/basics/gloo/hello_fbo.py
deleted file mode 100644
index db6f268..0000000
--- a/examples/basics/gloo/hello_fbo.py
+++ /dev/null
@@ -1,121 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 3
-
-"""
-Minimal example demonstrating the use of frame buffer objects (FBO).
-This example blurs the output image.
-"""
-
-
-from vispy import gloo
-from vispy import app
-import numpy as np
-
-# Create vetices
-vPosition = np.array([[-0.8, -0.8, 0.0], [+0.7, -0.7, 0.0],
- [-0.7, +0.7, 0.0], [+0.8, +0.8, 0.0, ]], np.float32)
-vPosition_full = np.array([[-1.0, -1.0, 0.0], [+1.0, -1.0, 0.0],
- [-1.0, +1.0, 0.0], [+1.0, +1.0, 0.0, ]], np.float32)
-vTexcoord = np.array([[0.0, 0.0], [0.0, 1.0],
- [1.0, 0.0], [1.0, 1.0]], np.float32)
-
-# For initial quad
-VERT_SHADER1 = """
-attribute vec3 a_position;
-void main (void) {
- gl_Position = vec4(a_position, 1.0);
-}
-"""
-
-FRAG_SHADER1 = """
-uniform vec4 u_color;
-void main()
-{
- gl_FragColor = u_color;
-}
-"""
-
-# To render the result of the FBO
-VERT_SHADER2 = """
-attribute vec3 a_position;
-attribute vec2 a_texcoord;
-varying vec2 v_texcoord;
-void main (void) {
- // Pass tex coords
- v_texcoord = a_texcoord;
- // Calculate position
- gl_Position = vec4(a_position.x, a_position.y, a_position.z, 1.0);
-}
-"""
-
-FRAG_SHADER2 = """
-uniform sampler2D u_texture1;
-varying vec2 v_texcoord;
-const float c_zero = 0.0;
-const int c_sze = 5;
-void main()
-{
- float scalefactor = 1.0 / float(c_sze * c_sze * 4 + 1);
- gl_FragColor = vec4(c_zero, c_zero, c_zero, 1.0);
- for (int y=-c_sze; y<=c_sze; y++) {
- for (int x=-c_sze; x<=c_sze; x++) {
- vec2 step = vec2(x,y) * 0.01;
- vec3 color = texture2D(u_texture1, v_texcoord.st+step).rgb;
- gl_FragColor.rgb += color * scalefactor;
- }
- }
-}
-"""
-
-
-SIZE = 50
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(560, 420))
-
- # Create texture to render to
- shape = self.physical_size[1], self.physical_size[0]
- self._rendertex = gloo.Texture2D((shape + (3,)))
-
- # Create FBO, attach the color buffer and depth buffer
- self._fbo = gloo.FrameBuffer(self._rendertex, gloo.RenderBuffer(shape))
-
- # Create program to render a shape
- self._program1 = gloo.Program(VERT_SHADER1, FRAG_SHADER1)
- self._program1['u_color'] = 0.9, 1.0, 0.4, 1
- self._program1['a_position'] = gloo.VertexBuffer(vPosition)
-
- # Create program to render FBO result
- self._program2 = gloo.Program(VERT_SHADER2, FRAG_SHADER2)
- self._program2['a_position'] = gloo.VertexBuffer(vPosition)
- self._program2['a_texcoord'] = gloo.VertexBuffer(vTexcoord)
- self._program2['u_texture1'] = self._rendertex
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- def on_draw(self, event):
- # Draw the same scene as as in hello_quad.py, but draw it to the FBO
- with self._fbo:
- gloo.set_clear_color((0.0, 0.0, 0.5, 1))
- gloo.clear(color=True, depth=True)
- gloo.set_viewport(0, 0, *self.physical_size)
- self._program1.draw('triangle_strip')
-
- # Now draw result to a full-screen quad
- # Init
- gloo.set_clear_color('white')
- gloo.clear(color=True, depth=True)
- self._program2.draw('triangle_strip')
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/basics/gloo/multi_texture.py b/examples/basics/gloo/multi_texture.py
deleted file mode 100644
index 3a9f24f..0000000
--- a/examples/basics/gloo/multi_texture.py
+++ /dev/null
@@ -1,88 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""Example demonstrating (and testing) multi-texturing.
-
-We create two textures. One that shows a red, green and blue band in
-the horizontal direction and one that does the same in the vertical
-direction. In the fragment shader the colors from both textures are
-added.
-"""
-
-import numpy as np
-
-from vispy import gloo
-from vispy import app
-
-
-# Images to be displayed
-W, H = 30, 30
-im1 = np.zeros((W, H, 3), np.float32)
-im2 = np.zeros((W, H, 3), np.float32)
-im1[:10, :, 0] = 1.0
-im1[10:20, :, 1] = 1.0
-im1[20:, :, 2] = 1.0
-im2[:, :10, 0] = 1.0
-im2[:, 10:20, 1] = 1.0
-im1[:, 20:, 2] = 1.0
-
-# A simple texture quad
-data = np.zeros(4, dtype=[('a_position', np.float32, 2),
- ('a_texcoord', np.float32, 2)])
-data['a_position'] = np.array([[-1, -1], [+1, -1], [-1, +1], [+1, +1]])
-data['a_texcoord'] = np.array([[1, 0], [1, 1.2], [0, 0], [0, 1.2]])
-
-
-VERT_SHADER = """
-attribute vec2 a_position;
-attribute vec2 a_texcoord;
-varying vec2 v_texcoord;
-
-void main (void)
-{
- v_texcoord = a_texcoord;
- gl_Position = vec4(a_position, 0.0, 1.0);
-}
-"""
-
-FRAG_SHADER = """
-uniform sampler2D u_tex1;
-uniform sampler2D u_tex2;
-varying vec2 v_texcoord;
-
-void main()
-{
- vec3 clr1 = texture2D(u_tex1, v_texcoord).rgb;
- vec3 clr2 = texture2D(u_tex2, v_texcoord).rgb;
- gl_FragColor.rgb = clr1 + clr2;
- gl_FragColor.a = 1.0;
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, size=(500, 500), keys='interactive')
-
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- self.program['u_tex1'] = gloo.Texture2D(im1, interpolation='linear')
- self.program['u_tex2'] = gloo.Texture2D(im2, interpolation='linear')
- self.program.bind(gloo.VertexBuffer(data))
-
- gloo.set_clear_color('white')
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
- self.program.draw('triangle_strip')
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/basics/gloo/post_processing.py b/examples/basics/gloo/post_processing.py
deleted file mode 100644
index 1e59055..0000000
--- a/examples/basics/gloo/post_processing.py
+++ /dev/null
@@ -1,153 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# Abstract: Show post-processing technique using framebuffer
-# Keywords: framebuffer, gloo, cube, post-processing
-# -----------------------------------------------------------------------------
-
-import numpy as np
-from vispy import app
-
-from vispy.geometry import create_cube
-from vispy.util.transforms import perspective, translate, rotate
-from vispy.gloo import (Program, VertexBuffer, IndexBuffer, Texture2D, clear,
- FrameBuffer, RenderBuffer, set_viewport, set_state)
-
-
-cube_vertex = """
-uniform mat4 model;
-uniform mat4 view;
-uniform mat4 projection;
-attribute vec3 position;
-attribute vec2 texcoord;
-attribute vec3 normal; // not used in this example
-attribute vec4 color; // not used in this example
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = projection * view * model * vec4(position,1.0);
- v_texcoord = texcoord;
-}
-"""
-
-cube_fragment = """
-uniform sampler2D texture;
-varying vec2 v_texcoord;
-void main()
-{
- float r = texture2D(texture, v_texcoord).r;
- gl_FragColor = vec4(r,r,r,1);
-}
-"""
-
-quad_vertex = """
-attribute vec2 position;
-attribute vec2 texcoord;
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0);
- v_texcoord = texcoord;
-}
-"""
-
-quad_fragment = """
-uniform sampler2D texture;
-varying vec2 v_texcoord;
-void main()
-{
- vec2 d = 5.0 * vec2(sin(v_texcoord.y*50.0),0)/512.0;
-
- // Inverse video
- if( v_texcoord.x > 0.5 ) {
- gl_FragColor.rgb = 1.0-texture2D(texture, v_texcoord+d).rgb;
- } else {
- gl_FragColor = texture2D(texture, v_texcoord);
- }
-}
-"""
-
-
-def checkerboard(grid_num=8, grid_size=32):
- row_even = grid_num // 2 * [0, 1]
- row_odd = grid_num // 2 * [1, 0]
- Z = np.row_stack(grid_num // 2 * (row_even, row_odd)).astype(np.uint8)
- return 255 * Z.repeat(grid_size, axis=0).repeat(grid_size, axis=1)
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, title='Framebuffer post-processing',
- keys='interactive', size=(512, 512))
-
- # Build cube data
- # --------------------------------------
- vertices, indices, _ = create_cube()
- vertices = VertexBuffer(vertices)
- self.indices = IndexBuffer(indices)
-
- # Build program
- # --------------------------------------
- view = translate((0, 0, -7))
- self.phi, self.theta = 60, 20
- model = rotate(self.theta, (0, 0, 1)).dot(rotate(self.phi, (0, 1, 0)))
-
- self.cube = Program(cube_vertex, cube_fragment)
- self.cube.bind(vertices)
- self.cube["texture"] = checkerboard()
- self.cube["texture"].interpolation = 'linear'
- self.cube['model'] = model
- self.cube['view'] = view
-
- color = Texture2D((512, 512, 3), interpolation='linear')
- self.framebuffer = FrameBuffer(color, RenderBuffer((512, 512)))
-
- self.quad = Program(quad_vertex, quad_fragment, count=4)
- self.quad['texcoord'] = [(0, 0), (0, 1), (1, 0), (1, 1)]
- self.quad['position'] = [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
- self.quad['texture'] = color
-
- # OpenGL and Timer initalization
- # --------------------------------------
- set_state(clear_color=(.3, .3, .35, 1), depth_test=True)
- self.timer = app.Timer('auto', connect=self.on_timer, start=True)
- self._set_projection(self.physical_size)
-
- self.show()
-
- def on_draw(self, event):
- with self.framebuffer:
- set_viewport(0, 0, 512, 512)
- clear(color=True, depth=True)
- set_state(depth_test=True)
- self.cube.draw('triangles', self.indices)
- set_viewport(0, 0, *self.physical_size)
- clear(color=True)
- set_state(depth_test=False)
- self.quad.draw('triangle_strip')
-
- def on_resize(self, event):
- self._set_projection(event.physical_size)
-
- def _set_projection(self, size):
- width, height = size
- set_viewport(0, 0, width, height)
- projection = perspective(30.0, width / float(height), 2.0, 10.0)
- self.cube['projection'] = projection
-
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- model = rotate(self.theta, (0, 0, 1)).dot(rotate(self.phi, (0, 1, 0)))
- self.cube['model'] = model
- self.update()
-
-if __name__ == '__main__':
- c = Canvas()
- c.app.run()
diff --git a/examples/basics/gloo/rotate_cube.py b/examples/basics/gloo/rotate_cube.py
deleted file mode 100644
index e9c54f4..0000000
--- a/examples/basics/gloo/rotate_cube.py
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 50
-"""
-This example shows how to display 3D objects.
-You should see a colored outlined spinning cube.
-"""
-
-import numpy as np
-from vispy import app, gloo
-from vispy.util.transforms import perspective, translate, rotate
-
-vert = """
-// Uniforms
-// ------------------------------------
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform vec4 u_color;
-
-// Attributes
-// ------------------------------------
-attribute vec3 a_position;
-attribute vec4 a_color;
-attribute vec3 a_normal;
-
-// Varying
-// ------------------------------------
-varying vec4 v_color;
-
-void main()
-{
- v_color = a_color * u_color;
- gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);
-}
-"""
-
-
-frag = """
-// Varying
-// ------------------------------------
-varying vec4 v_color;
-
-void main()
-{
- gl_FragColor = v_color;
-}
-"""
-
-
-# -----------------------------------------------------------------------------
-def cube():
- """
- Build vertices for a colored cube.
-
- V is the vertices
- I1 is the indices for a filled cube (use with GL_TRIANGLES)
- I2 is the indices for an outline cube (use with GL_LINES)
- """
- vtype = [('a_position', np.float32, 3),
- ('a_normal', np.float32, 3),
- ('a_color', np.float32, 4)]
- # Vertices positions
- v = [[1, 1, 1], [-1, 1, 1], [-1, -1, 1], [1, -1, 1],
- [1, -1, -1], [1, 1, -1], [-1, 1, -1], [-1, -1, -1]]
- # Face Normals
- n = [[0, 0, 1], [1, 0, 0], [0, 1, 0],
- [-1, 0, 1], [0, -1, 0], [0, 0, -1]]
- # Vertice colors
- c = [[0, 1, 1, 1], [0, 0, 1, 1], [0, 0, 0, 1], [0, 1, 0, 1],
- [1, 1, 0, 1], [1, 1, 1, 1], [1, 0, 1, 1], [1, 0, 0, 1]]
-
- V = np.array([(v[0], n[0], c[0]), (v[1], n[0], c[1]),
- (v[2], n[0], c[2]), (v[3], n[0], c[3]),
- (v[0], n[1], c[0]), (v[3], n[1], c[3]),
- (v[4], n[1], c[4]), (v[5], n[1], c[5]),
- (v[0], n[2], c[0]), (v[5], n[2], c[5]),
- (v[6], n[2], c[6]), (v[1], n[2], c[1]),
- (v[1], n[3], c[1]), (v[6], n[3], c[6]),
- (v[7], n[3], c[7]), (v[2], n[3], c[2]),
- (v[7], n[4], c[7]), (v[4], n[4], c[4]),
- (v[3], n[4], c[3]), (v[2], n[4], c[2]),
- (v[4], n[5], c[4]), (v[7], n[5], c[7]),
- (v[6], n[5], c[6]), (v[5], n[5], c[5])],
- dtype=vtype)
- I1 = np.resize(np.array([0, 1, 2, 0, 2, 3], dtype=np.uint32), 6 * (2 * 3))
- I1 += np.repeat(4 * np.arange(2 * 3, dtype=np.uint32), 6)
-
- I2 = np.resize(
- np.array([0, 1, 1, 2, 2, 3, 3, 0], dtype=np.uint32), 6 * (2 * 4))
- I2 += np.repeat(4 * np.arange(6, dtype=np.uint32), 8)
-
- return V, I1, I2
-
-
-# -----------------------------------------------------------------------------
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 600))
-
- self.vertices, self.filled, self.outline = cube()
- self.filled_buf = gloo.IndexBuffer(self.filled)
- self.outline_buf = gloo.IndexBuffer(self.outline)
-
- self.program = gloo.Program(vert, frag)
- self.program.bind(gloo.VertexBuffer(self.vertices))
-
- self.view = translate((0, 0, -5))
- self.model = np.eye(4, dtype=np.float32)
-
- gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])
- self.projection = perspective(45.0, self.size[0] /
- float(self.size[1]), 2.0, 10.0)
-
- self.program['u_projection'] = self.projection
-
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
-
- self.theta = 0
- self.phi = 0
-
- gloo.set_clear_color('white')
- gloo.set_state('opaque')
- gloo.set_polygon_offset(1, 1)
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- # ---------------------------------
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- self.model = np.dot(rotate(self.theta, (0, 1, 0)),
- rotate(self.phi, (0, 0, 1)))
- self.program['u_model'] = self.model
- self.update()
-
- # ---------------------------------
- def on_resize(self, event):
- gloo.set_viewport(0, 0, event.physical_size[0], event.physical_size[1])
- self.projection = perspective(45.0, event.size[0] /
- float(event.size[1]), 2.0, 10.0)
- self.program['u_projection'] = self.projection
-
- # ---------------------------------
- def on_draw(self, event):
- gloo.clear()
-
- # Filled cube
-
- gloo.set_state(blend=False, depth_test=True, polygon_offset_fill=True)
- self.program['u_color'] = 1, 1, 1, 1
- self.program.draw('triangles', self.filled_buf)
-
- # Outline
- gloo.set_state(blend=True, depth_test=True, polygon_offset_fill=False)
- gloo.set_depth_mask(False)
- self.program['u_color'] = 0, 0, 0, 1
- self.program.draw('lines', self.outline_buf)
- gloo.set_depth_mask(True)
-
-
-# -----------------------------------------------------------------------------
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/basics/gloo/start.py b/examples/basics/gloo/start.py
deleted file mode 100644
index 566bae1..0000000
--- a/examples/basics/gloo/start.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-""" Probably the simplest vispy example
-"""
-import sys
-
-from vispy import app, gloo
-
-canvas = app.Canvas(keys='interactive')
-
-
- at canvas.connect
-def on_draw(event):
- gloo.set_clear_color((0.2, 0.4, 0.6, 1.0))
- gloo.clear()
-
-canvas.show()
-
-if __name__ == '__main__' and sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/gloo/start_shaders.py b/examples/basics/gloo/start_shaders.py
deleted file mode 100644
index 7b6b5cb..0000000
--- a/examples/basics/gloo/start_shaders.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import sys
-
-from vispy import gloo
-from vispy import app
-import numpy as np
-
-VERT_SHADER = """
-attribute vec2 a_position;
-uniform float u_size;
-
-void main() {
- gl_Position = vec4(a_position, 0.0, 1.0);
- gl_PointSize = u_size;
-}
-"""
-
-FRAG_SHADER = """
-void main() {
- gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
-
- ps = self.pixel_scale
-
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- data = np.random.uniform(-0.5, 0.5, size=(20, 2))
- self.program['a_position'] = data.astype(np.float32)
- self.program['u_size'] = 20.*ps
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.size
- gloo.set_viewport(0, 0, width, height)
-
- def on_draw(self, event):
- gloo.clear('white')
- self.program.draw('points')
-
-if __name__ == '__main__':
- c = Canvas()
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/basics/plotting/export.py b/examples/basics/plotting/export.py
deleted file mode 100644
index d3a597b..0000000
--- a/examples/basics/plotting/export.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-"""
-Demonstrates rendering a canvas to an image at higher resolution than the
-original display.
-"""
-
-import vispy.plot as vp
-
-# Create a canvas showing plot data
-fig = vp.Fig()
-fig[0, 0].plot([1, 6, 2, 4, 3, 8, 5, 7, 6, 3])
-
-# Render the canvas scene to a numpy array image with higher resolution
-# than the original canvas
-scale = 4
-image = fig.render(size=(fig.size[0]*scale, fig.size[1]*scale))
-
-# Display the data in the array, sub-sampled down to the original canvas
-# resolution
-fig_2 = vp.Fig()
-fig_2[0, 0].image(image[::-scale, ::scale])
-
-# By default, the view adds some padding when setting its range.
-# We'll remove that padding so the image looks exactly like the original
-# canvas:
-fig_2[0, 0].camera.set_range(margin=0)
-
-if __name__ == '__main__':
- fig.app.run()
diff --git a/examples/basics/plotting/mpl_plot.py b/examples/basics/plotting/mpl_plot.py
deleted file mode 100644
index f7d589f..0000000
--- a/examples/basics/plotting/mpl_plot.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Example demonstrating how to use vispy.pyplot, which uses mplexporter
-to convert matplotlib commands to vispy draw commands.
-
-Requires matplotlib.
-"""
-
-import numpy as np
-
-# You can use either matplotlib or vispy to render this example:
-# import matplotlib.pyplot as plt
-import vispy.mpl_plot as plt
-
-from vispy.io import read_png, load_data_file
-
-n = 200
-freq = 10
-fs = 100.
-t = np.arange(n) / fs
-tone = np.sin(2*np.pi*freq*t)
-noise = np.random.RandomState(0).randn(n)
-signal = tone + noise
-magnitude = np.abs(np.fft.fft(signal))
-freqs = np.fft.fftfreq(n, 1. / fs)
-flim = n // 2
-
-# Signal
-fig = plt.figure()
-ax = plt.subplot(311)
-ax.imshow(read_png(load_data_file('pyplot/logo.png')))
-
-ax = plt.subplot(312)
-ax.plot(t, signal, 'k-')
-
-# Frequency content
-ax = plt.subplot(313)
-idx = np.argmax(magnitude[:flim])
-ax.text(freqs[idx], magnitude[idx], 'Max: %s Hz' % freqs[idx],
- verticalalignment='top')
-ax.plot(freqs[:flim], magnitude[:flim], 'k-o')
-
-plt.draw()
-
-# NOTE: show() has currently been overwritten to convert to vispy format, so:
-# 1. It must be called to show the results, and
-# 2. Any plotting commands executed after this will not take effect.
-# We are working to remove this limitation.
-
-if __name__ == '__main__':
- plt.show(True)
diff --git a/examples/basics/plotting/scatter_histogram.py b/examples/basics/plotting/scatter_histogram.py
deleted file mode 100644
index 0f13e7b..0000000
--- a/examples/basics/plotting/scatter_histogram.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-
-"""
-A scatter plot of 2D points with matching histograms.
-"""
-
-import numpy as np
-
-import vispy.plot as vp
-
-n = 100000
-data = np.random.randn(n, 2)
-color = (0.8, 0.25, 0.)
-n_bins = 100
-
-fig = vp.Fig(show=False)
-fig[0:4, 0:4].plot(data, width=0, face_color=color + (0.05,), edge_color=None,
- marker_size=10.)
-fig[4, 0:4].histogram(data[:, 0], bins=n_bins, color=color, orientation='h')
-fig[0:4, 4].histogram(data[:, 1], bins=n_bins, color=color, orientation='v')
-
-if __name__ == '__main__':
- fig.show(run=True)
diff --git a/examples/basics/plotting/spectrogram.py b/examples/basics/plotting/spectrogram.py
deleted file mode 100644
index f158634..0000000
--- a/examples/basics/plotting/spectrogram.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# vispy: gallery 1
-"""
-A spectrogram and waveform plot of 1D data.
-"""
-
-import numpy as np
-
-from vispy import plot as vp
-
-# Create a logarithmic chirp
-fs = 1000.
-N = 10000
-t = np.arange(N) / float(fs)
-f0, f1 = 1., 500.
-phase = (t[-1] / np.log(f1 / f0)) * f0 * (pow(f1 / f0, t / t[-1]) - 1.0)
-data = np.cos(2 * np.pi * phase)
-
-fig = vp.Fig(size=(800, 400), show=False)
-fig[0:2, 0].spectrogram(data, fs=fs, clim=(-100, -20))
-fig[2, 0].plot(np.array((t, data)).T, marker_size=0)
-
-if __name__ == '__main__':
- fig.show(run=True)
diff --git a/examples/basics/plotting/volume.py b/examples/basics/plotting/volume.py
deleted file mode 100644
index 2544cab..0000000
--- a/examples/basics/plotting/volume.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# vispy: gallery 1
-"""
-Plot various views of a structural MRI.
-"""
-
-import numpy as np
-
-from vispy import io, plot as vp
-
-fig = vp.Fig(bgcolor='k', size=(800, 800), show=False)
-
-vol_data = np.load(io.load_data_file('brain/mri.npz'))['data']
-vol_data = np.flipud(np.rollaxis(vol_data, 1))
-
-clim = [32, 192]
-vol_pw = fig[0, 0]
-vol_pw.volume(vol_data, clim=clim)
-vol_pw.camera.elevation = 30
-vol_pw.camera.azimuth = 30
-vol_pw.camera.scale_factor /= 1.5
-
-shape = vol_data.shape
-fig[1, 0].image(vol_data[:, :, shape[2] // 2], cmap='grays', clim=clim)
-fig[0, 1].image(vol_data[:, shape[1] // 2, :], cmap='grays', clim=clim)
-fig[1, 1].image(vol_data[shape[0] // 2, :, :].T, cmap='grays', clim=clim)
-
-if __name__ == '__main__':
- fig.show(run=True)
diff --git a/examples/basics/scene/background_borders.py b/examples/basics/scene/background_borders.py
deleted file mode 100644
index 85c1c36..0000000
--- a/examples/basics/scene/background_borders.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Demonstration of borders and background colors.
-"""
-
-from vispy.scene import SceneCanvas
-
-canvas = SceneCanvas(keys='interactive', bgcolor='w', show=True)
-grid = canvas.central_widget.add_grid(spacing=0, bgcolor='gray',
- border_color='k')
-view1 = grid.add_view(row=0, col=0, margin=10, bgcolor=(1, 0, 0, 0.5),
- border_color=(1, 0, 0))
-view2 = grid.add_view(row=0, col=1, margin=10, bgcolor=(0, 1, 0, 0.5),
- border_color=(0, 1, 0))
-
-if __name__ == '__main__':
- canvas.app.run()
diff --git a/examples/basics/scene/colored_line.py b/examples/basics/scene/colored_line.py
deleted file mode 100644
index 4bcda25..0000000
--- a/examples/basics/scene/colored_line.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Demonstration of various features of Line visual.
-"""
-import itertools
-import numpy as np
-
-from vispy import app, scene
-from vispy.color import get_colormaps
-from vispy.visuals.transforms import STTransform
-from vispy.ext.six import next
-
-colormaps = itertools.cycle(get_colormaps())
-
-# vertex positions of data to draw
-N = 200
-pos = np.zeros((N, 2), dtype=np.float32)
-pos[:, 0] = np.linspace(10, 390, N)
-pos[:, 1] = np.random.normal(size=N, scale=20, loc=0)
-
-
-canvas = scene.SceneCanvas(keys='interactive', size=(400, 200), show=True)
-
-# Create a visual that updates the line with different colormaps
-color = next(colormaps)
-line = scene.Line(pos=pos, color=color, method='gl')
-line.transform = STTransform(translate=[0, 140])
-line.parent = canvas.central_widget
-
-text = scene.Text(color, bold=True, font_size=24, color='w',
- pos=(200, 40), parent=canvas.central_widget)
-
-
-def on_timer(event):
- global colormaps, line, text, pos
- color = next(colormaps)
- line.set_data(pos=pos, color=color)
- text.text = color
-
-timer = app.Timer(.5, connect=on_timer, start=True)
-
-
-if __name__ == '__main__':
- canvas.app.run()
diff --git a/examples/basics/scene/console.py b/examples/basics/scene/console.py
deleted file mode 100644
index 18d1aaa..0000000
--- a/examples/basics/scene/console.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Demonstrate the use of the vispy console. Note how the console size is
-independent of the canvas scaling.
-"""
-import sys
-
-from vispy import scene, app
-from vispy.scene.widgets import Console
-from vispy.scene.visuals import Text
-
-canvas = scene.SceneCanvas(keys='interactive', size=(400, 400))
-grid = canvas.central_widget.add_grid()
-
-vb = scene.widgets.ViewBox(border_color='b')
-vb.camera = 'panzoom'
-vb.camera.rect = -1, -1, 2, 2
-grid.add_widget(vb, row=0, col=0)
-text = Text('Starting timer...', color='w', font_size=24, parent=vb.scene)
-
-console = Console(text_color='g', font_size=12., border_color='g')
-grid.add_widget(console, row=1, col=0)
-
-
-def on_timer(event):
- text.text = 'Tick #%s' % event.iteration
- if event.iteration > 1 and event.iteration % 10 == 0:
- console.clear()
- console.write('Elapsed:\n %s' % event.elapsed)
- canvas.update()
-
-timer = app.Timer(2.0, connect=on_timer, start=True)
-
-console.write('This is a line that will be wrapped automatically by the '
- 'console.\n')
-console.write('This line will be truncated ....................,\n'
- 'but this next line will survive.\n', wrap=False)
-
-if __name__ == '__main__':
- canvas.show()
- if sys.flags.interactive != 1:
- canvas.app.run()
diff --git a/examples/basics/scene/cube.py b/examples/basics/scene/cube.py
deleted file mode 100644
index d9fdaf4..0000000
--- a/examples/basics/scene/cube.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Simple use of SceneCanvas to display a cube with an arcball camera.
-"""
-import sys
-
-from vispy import scene
-
-canvas = scene.SceneCanvas(keys='interactive', size=(800, 600), show=True)
-
-# Set up a viewbox to display the cube with interactive arcball
-view = canvas.central_widget.add_view()
-cube = scene.visuals.Cube(edge_color='k', parent=view.scene)
-view.camera = 'arcball'
-view.camera.fov = 30.
-
-if __name__ == '__main__' and sys.flags.interactive == 0:
- canvas.app.run()
diff --git a/examples/basics/scene/flipped_axis.py b/examples/basics/scene/flipped_axis.py
deleted file mode 100644
index f649fb1..0000000
--- a/examples/basics/scene/flipped_axis.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# vispy: gallery 2
-
-"""
-Example demonstrating the use of aspect ratio, and also the flipping
-of axis using negative aspect ratios.
-
-Keys:
-* 1: flip x dimenstion
-* 2: flip y dimension
-* 3: flip z dimenstion
-* 4: cycle through up-vectors
-* 5: cycle through cameras
-"""
-
-from itertools import cycle
-
-import numpy as np
-
-from vispy import app, scene, io
-from vispy.ext.six import next
-
-# Read volume
-vol1 = np.load(io.load_data_file('volume/stent.npz'))['arr_0']
-
-# Prepare canvas
-canvas = scene.SceneCanvas(keys='interactive', size=(800, 600), show=True)
-canvas.measure_fps()
-
-# Set up a viewbox to display the image with interactive pan/zoom
-view = canvas.central_widget.add_view()
-
-# Create the volume visuals, only one is visible
-volume1 = scene.visuals.Volume(vol1, parent=view.scene, threshold=0.5)
-#volume1.method = 'iso'
-volume1.threshold = 0.1
-
-# Plot a line that shows where positive x is, with at the end a small
-# line pointing at positive y
-arr = np.array([(100, -1, -1), (-1, -1, -1), (-1, 10, -1)])
-line1 = scene.visuals.Line(arr, color='red', parent=view.scene)
-
-# Create cameras
-cam1 = scene.cameras.PanZoomCamera(parent=view.scene, aspect=1)
-cam2 = scene.cameras.FlyCamera(parent=view.scene)
-cam3 = scene.cameras.TurntableCamera(fov=60, parent=view.scene)
-cam4 = scene.cameras.ArcballCamera(fov=60, parent=view.scene)
-cams = (cam1, cam2, cam3, cam4)
-view.camera = cam3 # Select turntable at first
-
-ups = cycle(('+z', '-z', '+y', '-y', '+x', '-x'))
-
-
-# Implement key presses
- at canvas.events.key_press.connect
-def on_key_press(event):
- if event.text == '1':
- for cam in cams:
- flip = cam.flip
- cam.flip = not flip[0], flip[1], flip[2]
- elif event.text == '2':
- for cam in cams:
- flip = cam.flip
- cam.flip = flip[0], not flip[1], flip[2]
- elif event.text == '3':
- for cam in cams:
- flip = cam.flip
- cam.flip = flip[0], flip[1], not flip[2]
- elif event.text == '4':
- up = next(ups)
- print('up: ' + up)
- for cam in cams:
- cam.up = up
- if event.text == '5':
- cam_toggle = {cam1: cam2, cam2: cam3, cam3: cam4, cam4: cam1}
- view.camera = cam_toggle.get(view.camera, 'fly')
- elif event.text == '0':
- for cam in cams:
- cam.set_range()
-
-if __name__ == '__main__':
- print(__doc__)
- app.run()
diff --git a/examples/basics/scene/grid.py b/examples/basics/scene/grid.py
deleted file mode 100644
index 0656421..0000000
--- a/examples/basics/scene/grid.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Test automatic layout of multiple viewboxes using Grid.
-"""
-import sys
-import numpy as np
-
-from vispy import scene, app
-
-canvas = scene.SceneCanvas(keys='interactive')
-canvas.size = 600, 600
-canvas.show()
-
-# This is the top-level widget that will hold three ViewBoxes, which will
-# be automatically resized whenever the grid is resized.
-grid = canvas.central_widget.add_grid()
-
-
-# Add 3 ViewBoxes to the grid
-b1 = grid.add_view(row=0, col=0, col_span=2)
-b1.camera = 'panzoom'
-b1.border_color = (0.5, 0.5, 0.5, 1)
-b1.camera = scene.PanZoomCamera(rect=(-0.5, -5, 11, 10))
-b1.border = (1, 0, 0, 1)
-
-b2 = grid.add_view(row=1, col=0)
-b2.camera = 'panzoom'
-b2.border_color = (0.5, 0.5, 0.5, 1)
-b2.camera = scene.PanZoomCamera(rect=(-10, -5, 15, 10))
-b2.border = (1, 0, 0, 1)
-
-b3 = grid.add_view(row=1, col=1)
-b3.camera = 'panzoom'
-b3.border_color = (0.5, 0.5, 0.5, 1)
-b3.camera = scene.PanZoomCamera(rect=(-5, -5, 10, 10))
-b3.border = (1, 0, 0, 1)
-
-
-# Generate some random vertex data and a color gradient
-N = 10000
-pos = np.empty((N, 2), dtype=np.float32)
-pos[:, 0] = np.linspace(0, 10, N)
-pos[:, 1] = np.random.normal(size=N)
-pos[5000, 1] += 50
-
-color = np.ones((N, 4), dtype=np.float32)
-color[:, 0] = np.linspace(0, 1, N)
-color[:, 1] = color[::-1, 0]
-
-# Top grid cell shows plot data in a rectangular coordinate system.
-l1 = scene.visuals.Line(pos=pos, color=color, antialias=False, method='gl')
-b1.add(l1)
-grid1 = scene.visuals.GridLines(parent=b1.scene)
-
-# Bottom-left grid cell shows the same data with log-transformed X
-e2 = scene.Node(parent=b2.scene)
-e2.transform = scene.transforms.LogTransform(base=(2, 0, 0))
-l2 = scene.visuals.Line(pos=pos, color=color, antialias=False, parent=e2,
- method='gl')
-grid2 = scene.visuals.GridLines(parent=e2)
-
-# Bottom-right grid cell shows the same data again, but with a much more
-# interesting transformation.
-e3 = scene.Node(parent=b3.scene)
-affine = scene.transforms.AffineTransform()
-affine.scale((1, 0.1))
-affine.rotate(10, (0, 0, 1))
-affine.translate((0, 1))
-e3.transform = scene.transforms.ChainTransform([
- scene.transforms.PolarTransform(),
- affine])
-l3 = scene.visuals.Line(pos=pos, color=color, antialias=False, parent=e3,
- method='gl')
-grid3 = scene.visuals.GridLines(scale=(np.pi/6., 1.0), parent=e3)
-
-if __name__ == '__main__' and sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/grid_large.py b/examples/basics/scene/grid_large.py
deleted file mode 100644
index 4e552e3..0000000
--- a/examples/basics/scene/grid_large.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip # disabled due to segfaults on travis
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Test automatic layout of multiple viewboxes using Grid.
-"""
-
-import sys
-from vispy import scene
-from vispy import app
-import numpy as np
-
-canvas = scene.SceneCanvas(keys='interactive')
-canvas.size = 600, 600
-canvas.show()
-
-grid = canvas.central_widget.add_grid()
-
-
-N = 10000
-lines = []
-for i in range(10):
- lines.append([])
- for j in range(10):
- vb = grid.add_view(row=i, col=j)
- vb.camera = 'panzoom'
- vb.camera.rect = (0, -5), (100, 10)
- vb.border = (1, 1, 1, 0.4)
-
- pos = np.empty((N, 2), dtype=np.float32)
- pos[:, 0] = np.linspace(0, 100, N)
- pos[:, 1] = np.random.normal(size=N)
- line = scene.visuals.Line(pos=pos, color=(1, 1, 1, 0.5), method='gl')
- vb.add(line)
-
-
-if __name__ == '__main__' and sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/image.py b/examples/basics/scene/image.py
deleted file mode 100644
index d975a07..0000000
--- a/examples/basics/scene/image.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Simple use of SceneCanvas to display an Image.
-"""
-import sys
-from vispy import scene
-from vispy import app
-import numpy as np
-
-canvas = scene.SceneCanvas(keys='interactive')
-canvas.size = 800, 600
-canvas.show()
-
-# Set up a viewbox to display the image with interactive pan/zoom
-view = canvas.central_widget.add_view()
-
-# Create the image
-img_data = np.random.normal(size=(100, 100, 3), loc=128,
- scale=50).astype(np.ubyte)
-image = scene.visuals.Image(img_data, parent=view.scene)
-
-# Set 2D camera (the camera will scale to the contents in the scene)
-view.camera = scene.PanZoomCamera(aspect=1)
-
-if __name__ == '__main__' and sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/isocurve.py b/examples/basics/scene/isocurve.py
deleted file mode 100644
index cd8466c..0000000
--- a/examples/basics/scene/isocurve.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Simple use of SceneCanvas to display an Isocurve visual.
-"""
-import sys
-from vispy import app, scene, visuals
-from vispy.util.filter import gaussian_filter
-import numpy as np
-
-canvas = scene.SceneCanvas(keys='interactive')
-canvas.size = 800, 600
-canvas.show()
-
-# Set up a viewbox to display the image with interactive pan/zoom
-view = canvas.central_widget.add_view()
-
-# Create the image
-img_data = np.empty((100, 100, 3), dtype=np.ubyte)
-noise = np.random.normal(size=(100, 100), loc=50, scale=150)
-noise = gaussian_filter(noise, (4, 4, 0))
-img_data[:] = noise[..., np.newaxis]
-image = scene.visuals.Image(img_data, parent=view.scene)
-# move image behind curves
-image.transform = visuals.transforms.STTransform(translate=(0, 0, 0.5))
-
-# Create isocurve, make a child of the image to ensure the two are always
-# aligned.
-curve1 = scene.visuals.Isocurve(noise, level=60, color=(1, 1, 0, 1),
- parent=view.scene)
-curve2 = scene.visuals.Isocurve(noise, level=50, color=(1, 0.5, 0, 1),
- parent=view.scene)
-curve3 = scene.visuals.Isocurve(noise, level=40, color=(1, 0, 0, 1),
- parent=view.scene)
-
-# Set 2D camera (the camera will scale to the contents in the scene)
-view.camera = scene.PanZoomCamera(aspect=1)
-
-
-if __name__ == '__main__' and sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/isocurve_for_trisurface.py b/examples/basics/scene/isocurve_for_trisurface.py
deleted file mode 100644
index 8bf9215..0000000
--- a/examples/basics/scene/isocurve_for_trisurface.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-
-"""
-This example demonstrates isocurve for triangular mesh with vertex data.
-"""
-
-import numpy as np
-
-from vispy import app, scene
-
-from vispy.geometry.generation import create_sphere
-
-import sys
-
-# Create a canvas with a 3D viewport
-canvas = scene.SceneCanvas(keys='interactive')
-canvas.show()
-view = canvas.central_widget.add_view()
-
-cols = 10
-rows = 10
-radius = 2
-nbr_level = 20
-mesh = create_sphere(cols, rows, radius=radius)
-vertices = mesh.get_vertices()
-tris = mesh.get_faces()
-
-cl = np.linspace(-radius, radius, nbr_level+2)[1:-1]
-
-scene.visuals.Isoline(vertices=vertices, tris=tris, data=vertices[:, 2],
- levels=cl, color_lev='winter', parent=view.scene)
-
-# Add a 3D axis to keep us oriented
-scene.visuals.XYZAxis(parent=view.scene)
-
-view.camera = scene.TurntableCamera()
-view.camera.set_range((-1, 1), (-1, 1), (-1, 1))
-
-if __name__ == '__main__':
- canvas.show()
- if sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/isosurface.py b/examples/basics/scene/isosurface.py
deleted file mode 100644
index ab3ffaf..0000000
--- a/examples/basics/scene/isosurface.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-
-"""
-This example demonstrates the use of the Isosurface visual.
-"""
-
-import sys
-import numpy as np
-
-from vispy import app, scene
-
-# Create a canvas with a 3D viewport
-canvas = scene.SceneCanvas(keys='interactive')
-view = canvas.central_widget.add_view()
-
-
-## Define a scalar field from which we will generate an isosurface
-def psi(i, j, k, offset=(25, 25, 50)):
- x = i-offset[0]
- y = j-offset[1]
- z = k-offset[2]
- th = np.arctan2(z, (x**2+y**2)**0.5)
- r = (x**2 + y**2 + z**2)**0.5
- a0 = 1
- ps = ((1./81.) * 1./(6.*np.pi)**0.5 * (1./a0)**(3/2) * (r/a0)**2 *
- np.exp(-r/(3*a0)) * (3 * np.cos(th)**2 - 1))
- return ps
-
-print("Generating scalar field..")
-data = np.abs(np.fromfunction(psi, (50, 50, 100)))
-
-# Create isosurface visual
-surface = scene.visuals.Isosurface(data, level=data.max()/4.,
- color=(0.5, 0.6, 1, 1), shading='smooth',
- parent=view.scene)
-surface.transform = scene.transforms.STTransform(translate=(-25, -25, -50))
-
-# Add a 3D axis to keep us oriented
-axis = scene.visuals.XYZAxis(parent=view.scene)
-
-# Use a 3D camera
-# Manual bounds; Mesh visual does not provide bounds yet
-# Note how you can set bounds before assigning the camera to the viewbox
-cam = scene.TurntableCamera(elevation=30, azimuth=30)
-cam.set_range((-10, 10), (-10, 10), (-10, 10))
-view.camera = cam
-
-
-if __name__ == '__main__':
- canvas.show()
- if sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/line.py b/examples/basics/scene/line.py
deleted file mode 100644
index 6fc9cd2..0000000
--- a/examples/basics/scene/line.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Simple demonstration of SceneCanvas containing a single line entity
-as its entire scenegraph.
-"""
-import sys
-import numpy as np
-
-from vispy import app, scene
-
-canvas = scene.SceneCanvas(size=(800, 600), keys='interactive')
-
-N = 1000
-pos = np.empty((N, 2), np.float32)
-pos[:, 0] = np.linspace(50., 750., N)
-#
-color = np.ones((N, 4), dtype=np.float32)
-color[:, 0] = np.linspace(0, 1, N)
-color[:, 1] = color[::-1, 0]
-
-lines = []
-
-print('Generating points...')
-for i in range(20):
- pos = pos.copy()
- pos[:, 1] = np.random.normal(scale=5, loc=(i+1)*30, size=N)
- line = scene.visuals.Line(pos=pos, color=color, parent=canvas.scene)
- lines.append(line)
- line.transform = scene.transforms.STTransform()
-print('Done')
-
-
-def update(event):
- for line in lines:
- scale = [np.sin(np.pi * event.elapsed)+2,
- np.cos(np.pi * event.elapsed)+2]
- line.transform.scale = scale
-
-timer = app.Timer('auto', connect=update, start=True)
-
-if __name__ == '__main__':
- canvas.show()
- if sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/line_update.py b/examples/basics/scene/line_update.py
deleted file mode 100644
index bf019aa..0000000
--- a/examples/basics/scene/line_update.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip # disabled due to segfaults on travis
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Demonstration of animated Line visual.
-"""
-
-import sys
-import numpy as np
-from vispy import app, scene
-
-# vertex positions of data to draw
-N = 200
-pos = np.zeros((N, 2), dtype=np.float32)
-pos[:, 0] = np.linspace(50., 750., N)
-pos[:, 1] = np.random.normal(size=N, scale=100, loc=400)
-
-# color array
-color = np.ones((N, 4), dtype=np.float32)
-color[:, 0] = np.linspace(0, 1, N)
-color[:, 1] = color[::-1, 0]
-
-canvas = scene.SceneCanvas(keys='interactive', size=(800, 800), show=True)
-
-line = scene.Line(pos, color, parent=canvas.scene)
-
-
-def update(ev):
- global pos, color, line
- pos[:, 1] = np.random.normal(size=N, scale=100, loc=400)
- color = np.roll(color, 1, axis=0)
- line.set_data(pos=pos, color=color)
-
-timer = app.Timer()
-timer.connect(update)
-timer.start(0)
-
-if __name__ == '__main__' and sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/modular_shaders/editor.py b/examples/basics/scene/modular_shaders/editor.py
deleted file mode 100644
index 8647e64..0000000
--- a/examples/basics/scene/modular_shaders/editor.py
+++ /dev/null
@@ -1,196 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-# QScintilla editor
-#
-# Adapted from Eli Bendersky (eliben at gmail.com)
-# This code is in the public domain
-#
-# API: http://pyqt.sourceforge.net/Docs/QScintilla2/classQsciScintilla.html
-#
-"""
-
-import sys
-import re
-from PyQt4.QtCore import * # noqa
-from PyQt4.QtGui import * # noqa
-
-
-try:
- from PyQt4 import Qsci
- from PyQt4.Qsci import QsciScintilla
- HAVE_QSCI = True
-except ImportError:
- HAVE_QSCI = False
-
-if not HAVE_QSCI:
- # backup editor in case QScintilla is not available
- class Editor(QPlainTextEdit):
- def __init__(self, parent=None, language=None):
- QPlainTextEdit.__init__(self, parent)
-
- def setText(self, text):
- self.setPlainText(text)
-
- def text(self):
- return str(self.toPlainText()).encode('UTF-8')
-
- def __getattr__(self, name):
- return lambda: None
-
-else:
- class Editor(QsciScintilla):
- ARROW_MARKER_NUM = 8
-
- def __init__(self, parent=None, language='Python'):
- super(Editor, self).__init__(parent)
- self.setIndentationsUseTabs(False)
- self.setIndentationWidth(4)
-
- # Set the default font
- font = QFont()
- font.setFamily('DejaVu Sans Mono')
- font.setFixedPitch(True)
- font.setPointSize(10)
- self.setFont(font)
- self.setMarginsFont(font)
- self.zoomIn()
-
- # Margin 0 is used for line numbers
- fontmetrics = QFontMetrics(font)
- self.setMarginsFont(font)
- self.setMarginWidth(0, fontmetrics.width("000") + 6)
- self.setMarginLineNumbers(0, True)
- self.setMarginsBackgroundColor(QColor("#cccccc"))
-
- self._marker = None
- # Clickable margin 1 for showing markers
- #self.setMarginSensitivity(1, True)
- #self.connect(self,
- # SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),
- # self.on_margin_clicked)
- self.markerDefine(QsciScintilla.RightArrow, self.ARROW_MARKER_NUM)
- self.setMarkerBackgroundColor(QColor("#ee1111"),
- self.ARROW_MARKER_NUM)
-
- # Brace matching: enable for a brace immediately before or after
- # the current position
- #
- self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
-
- # Current line visible with special background color
- self.setCaretLineVisible(True)
- self.setCaretLineBackgroundColor(QColor("#ffe4e4"))
-
- # Set Python lexer
- # Set style for Python comments (style number 1) to a fixed-width
- # courier.
- #
- lexer = getattr(Qsci, 'QsciLexer' + language)()
- lexer.setDefaultFont(font)
- self.setLexer(lexer)
- self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')
-
- # Don't want to see the horizontal scrollbar at all
- # Use raw message to Scintilla here (all messages are documented
- # here: http://www.scintilla.org/ScintillaDoc.html)
- self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
-
- self.setWrapMode(QsciScintilla.WrapWord)
-
- self.setEolMode(QsciScintilla.EolUnix)
- # not too small
- #self.setMinimumSize(600, 450)
-
- def set_marker(self, line):
- self.clear_marker()
- self.markerAdd(line, self.ARROW_MARKER_NUM)
- self._marker = line
-
- def clear_marker(self):
- if self._marker is not None:
- self.markerDelete(self._marker, self.ARROW_MARKER_NUM)
-
- #def on_margin_clicked(self, nmargin, nline, modifiers):
- ## Toggle marker for the line the margin was clicked on
- #if self.markersAtLine(nline) != 0:
- #self.markerDelete(nline, self.ARROW_MARKER_NUM)
- #else:
- #self.markerAdd(nline, self.ARROW_MARKER_NUM)
-
- def wheelEvent(self, ev):
- # Use ctrl+wheel to zoom in/out
- if Qt.ControlModifier & ev.modifiers():
- if ev.delta() > 0:
- self.zoomIn()
- else:
- self.zoomOut()
- else:
- return super(Editor, self).wheelEvent(ev)
-
- def keyPressEvent(self, ev):
- if int(Qt.ControlModifier & ev.modifiers()) > 0:
- if ev.key() == Qt.Key_Slash:
- self.comment(True)
- return
- elif ev.key() == Qt.Key_Question:
- self.comment(False)
- return
- elif (ev.key() == Qt.Key_Z and
- Qt.ShiftModifier & ev.modifiers()):
- self.redo()
- return
- elif ev.key() == Qt.Key_Q:
- sys.exit(0)
- return super(Editor, self).keyPressEvent(ev)
-
- def text(self):
- return str(super(Editor, self).text()).encode('UTF-8')
-
- def comment(self, comment=True):
- sel = self.getSelection()[:]
- text = self.text()
- lines = text.split('\n')
- if sel[0] == -1:
- # toggle for just this line
- row, col = self.getCursorPosition()
- line = lines[row]
- self.setSelection(row, 0, row, len(line))
- if comment:
- line = '#' + line
- else:
- line = line.replace("#", "", 1)
- self.replaceSelectedText(line)
- self.setCursorPosition(row, col+(1 if col > 0 else 0))
- else:
- block = lines[sel[0]:sel[2]]
- # make sure all lines have #
- new = []
- if comment:
- for line in block:
- new.append('#' + line)
- else:
- for line in block:
- if line.strip() == '':
- new.append(line)
- continue
- if re.match(r'\s*\#', line) is None:
- return
- new.append(line.replace('#', '', 1))
- self.setSelection(sel[0], 0, sel[2], 0)
- self.replaceSelectedText('\n'.join(new) + '\n')
- #shift = 1 if comment else -1
- self.setSelection(sel[0], max(0, sel[1]), sel[2], sel[3])
-
-
-if __name__ == "__main__":
- app = QApplication(sys.argv)
- editor = Editor()
- editor.show()
- editor.setText(open(sys.argv[0]).read())
- editor.resize(800, 800)
- app.exec_()
diff --git a/examples/basics/scene/modular_shaders/sandbox.py b/examples/basics/scene/modular_shaders/sandbox.py
deleted file mode 100644
index 7416844..0000000
--- a/examples/basics/scene/modular_shaders/sandbox.py
+++ /dev/null
@@ -1,618 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Sandbox for experimenting with vispy.visuals.shaders
-"""
-from PyQt4 import QtCore
-from PyQt4.QtGui import * # noqa
-import sys
-import traceback
-
-from editor import Editor, HAVE_QSCI
-
-
-presets = [
- ('Introduction', '''
-"""
- ------ Shader Composition Sandbox -------
-
-Instructions:
-
-1) Edit this code; it is immediately executed after every change. Exceptions
- will be displayed on the right side.
-
-2) Assign strings to VERTEX and FRAGMENT variables (see below) and they will
- appear in the windows to the right.
-
-3) Select presets from the list above to see a few examples.
-
-"""
-
-
-from vispy.visuals.shaders import ModularProgram
-
-vertex_shader = "void main() {}"
-fragment_shader = "void main() {}"
-
-program = ModularProgram(vertex_shader, fragment_shader)
-
-# obligatory: these variables are used to fill the text fields on the right.
-program._compile()
-VERTEX = program.vert_code
-FRAGMENT = program.frag_code
-'''),
-
-
- ('Simple hook', '''
-"""
-In this example we define a 'hook' in the vertex shader: a function prototype
-with no definition. By leaving this function undefined, any new function
-definition may be concatenated to the shader.
-"""
-
-from vispy.visuals.shaders import ModularProgram, Function
-
-# The hook is called 'input_position', and is used to provide the
-# value for gl_Position.
-vertex_shader = """
-vec4 input_position();
-
-void main() {
- gl_Position = input_position();
-}
-"""
-
-fragment_shader = """
-void main() {
-}
-"""
-
-# ModularProgram parses the shader code for function prototypes
-# and registers each as a hook.
-program = ModularProgram(vertex_shader, fragment_shader)
-
-# Now we make a new function definition and attach it to the program.
-func = Function("""
- vec4 input_position() {
- return vec4(0,0,0,0);
- }
- """)
-
-program['input_position'] = func
-
-
-# obligatory: these variables are used to fill the text fields on the right.
-program._compile()
-VERTEX = program.vert_code
-FRAGMENT = program.frag_code
-'''),
-
-
- ('Anonymous functions', '''
-"""
-Functions may optionally be defined with '$' in front of the function name.
-This indicates that the function is anonymous (has no name) and thus may be
-assigned any new name in the program.
-
-The major benefit to using anonymous functions is that the modular shader
-system is free to rename functions that would otherwise conflict with each
-other.
-
-In this example, an anonymous function is assigned to a hook. When it is
-compiled into the complete program, it is renamed to match the hook.
-"""
-
-from vispy.visuals.shaders import ModularProgram, Function
-
-vertex_shader = """
-vec4 input_position();
-
-void main() {
- gl_Position = input_position();
-}
-"""
-
-fragment_shader = """
-void main() {
-}
-"""
-
-program = ModularProgram(vertex_shader, fragment_shader)
-
-# Now we make a new function definition and attach it to the program.
-# Note that this function is anonymous (name begins with '$') and does not
-# have the correct name to be attached to the input_position hook.
-func = Function("""
- vec4 $my_function() {
- return vec4(0,0,0,0);
- }
- """)
-
-program['input_position'] = func
-
-
-# obligatory: these variables are used to fill the text fields on the right.
-program._compile()
-VERTEX = program.vert_code
-FRAGMENT = program.frag_code
-'''),
-
-
- ('Program variables', '''
-"""
-Many Functions need to define their own program variables
-(uniform/attribute/varying) in order to operate correctly. However, with many
-independent functions added to a ModularProgram, it is likely that two
-Functions might try to define variables of the same name.
-
-To solve this, Functions may use $anonymous_variables that will be assigned to
-a real program variable at compile time.
-
-In the next example, we will see how ModularProgram resolves name conflicts.
-"""
-
-from vispy.visuals.shaders import ModularProgram, Function
-import numpy as np
-
-vertex_shader = """
-vec4 transform_position(vec4);
-
-attribute vec4 position_a;
-
-void main() {
- gl_Position = transform_position(position_a);
-}
-"""
-
-fragment_shader = """
-void main() {
-}
-"""
-
-program = ModularProgram(vertex_shader, fragment_shader)
-
-# Define a function to do a matrix transform.
-# The variable $matrix will be substituted with a uniquely-named program
-# variable when the function is compiled.
-func = Function("""
- vec4 $matrix_transform(vec4 pos) {
- return $matrix * pos;
- }
- """)
-
-# The definition for 'matrix' must indicate the variable type and data type.
-func['matrix'] = ('uniform', 'mat4', np.eye(4))
-
-
-program.set_hook('transform_position', func)
-
-
-# obligatory: these variables are used to fill the text fields on the right.
-program._compile()
-VERTEX = program.vert_code
-FRAGMENT = program.frag_code
-
-'''),
-
-
- ('Resolving name conflicts', '''
-"""
-When anonymous functions and variables have conflicting names, the
-ModularProgram will generate unique names by appending _N to the end of the
-name.
-
-This example demonstrates dynamic naming of a program variable.
-"""
-
-from vispy.visuals.shaders import ModularProgram, Function
-import numpy as np
-
-vertex_shader = """
-vec4 projection(vec4);
-vec4 modelview(vec4);
-
-attribute vec4 position_a;
-
-void main() {
- gl_Position = projection(modelview(position_a));
-}
-"""
-
-fragment_shader = """
-void main() {
-}
-"""
-
-program = ModularProgram(vertex_shader, fragment_shader)
-
-# Define two identical functions
-projection = Function("""
- vec4 $matrix_transform(vec4 pos) {
- return $matrix * pos;
- }
- """)
-projection['matrix'] = ('uniform', 'mat4', np.eye(4))
-
-modelview = Function("""
- vec4 $matrix_transform(vec4 pos) {
- return $matrix * pos;
- }
- """)
-modelview['matrix'] = ('uniform', 'mat4', np.eye(4))
-
-
-program.set_hook('projection', projection)
-program.set_hook('modelview', modelview)
-
-
-# obligatory: these variables are used to fill the text fields on the right.
-program._compile()
-VERTEX = program.vert_code
-FRAGMENT = program.frag_code
-
-'''),
-
-
- ('Function chaining', '''
-"""
-Function chains are another essential component of shader composition,
-allowing a list of functions to be executed in order.
-"""
-
-from vispy.visuals.shaders import ModularProgram, Function, FunctionChain
-
-# Added a new hook to allow any number of functions to be executed
-# after gl_Position is set.
-vertex_shader = """
-void vert_post_hook();
-
-attribute vec4 position_a;
-
-void main() {
- gl_Position = position_a;
- vert_post_hook();
-}
-"""
-
-fragment_shader = """
-void main() {
-}
-"""
-
-program = ModularProgram(vertex_shader, fragment_shader)
-
-# Add a function to flatten the z-position of the vertex
-flatten = Function("""
- void flatten_func() {
- gl_Position.z = 0;
- }
- """)
-
-# Add another function that copies an attribute to a varying
-# for use in the fragment shader
-read_color_attr = Function("""
- void $read_color_attr() {
- $output = $input;
- }
- """)
-
-# ..and set two new program variables:
-# (note that no value is needed for varyings)
-read_color_attr['output'] = ('varying', 'vec4')
-read_color_attr['input'] = ('attribute', 'vec4', 'color_a')
-
-
-# Now create a chain that calls both functions in sequence
-post_chain = FunctionChain('vert_post_hook', [flatten, read_color_attr])
-
-program.set_hook('vert_post_hook', post_chain)
-
-
-# obligatory: these variables are used to fill the text fields on the right.
-program._compile()
-VERTEX = program.vert_code
-FRAGMENT = program.frag_code
-'''),
-
-
- ('Function composition', '''
-"""
-Chains may also be used to generate a function composition where the return
-value of each function call supplies the input to the next argument.
-Thus, the original input is transformed in a series steps.
-
-This is most commonly used for passing vertex positions through a composition
-of transform functions.
-"""
-
-from vispy.visuals.shaders import ModularProgram, Function, FunctionChain
-
-
-vertex_shader = """
-vec4 transform_chain(vec4);
-
-attribute vec4 position_a;
-
-void main() {
- gl_Position = transform_chain(position_a);
-}
-"""
-
-fragment_shader = """
-void main() {
-}
-"""
-
-program = ModularProgram(vertex_shader, fragment_shader)
-
-flatten = Function("""
- vec4 flatten_func(vec4 pos) {
- pos.z = 0;
- pos.w = 1;
- return pos;
- }
- """)
-
-# Define a scaling function
-scale = Function("""
- vec4 $scale_vertex(vec4 pos) {
- return pos * vec4($scale, 1);
- }
- """)
-scale['scale'] = ('uniform', 'vec3', (2, 1, 1))
-
-# Assigning a list of both functions to a program hook will gemerate a
-# composition of functions:
-program['transform_chain'] = [flatten, scale]
-
-# Internally, this creates a FunctionChain:
-# transform = FunctionChain('transform_chain', [flatten, scale])
-
-
-# obligatory: these variables are used to fill the text fields on the right.
-program._compile()
-VERTEX = program.vert_code
-FRAGMENT = program.frag_code
-
-'''),
-
-
- ('Fragment shaders', '''
-"""
-Although the prior examples focused on vertex shaders, these concepts
-apply equally well for fragment shaders.
-
-However: fragment shaders have one limitation that makes them very
-different--they lack attributes. In order to supply attribute data
-to a fragment shader, we will need to introduce some supporting code
-to the vertex shader.
-"""
-
-from vispy.visuals.shaders import (ModularProgram, Function, FunctionChain)
-from vispy.gloo import VertexBuffer
-import numpy as np
-
-# we require a void hook in the vertex shader that can be used
-# to attach supporting code for the fragment shader.
-vertex_shader = """
-void vert_post_hook();
-
-attribute vec4 position_a
-
-void main() {
- gl_Position = position_a;
- vert_post_hook();
-}
-"""
-
-# add a hook to the fragment shader to allow arbitrary color input
-fragment_shader = """
-vec4 fragment_color();
-
-void main() {
- gl_FragColor = fragment_color();
-}
-"""
-
-program = ModularProgram(vertex_shader, fragment_shader)
-
-# First, define a simple fragment color function and bind it to a varying
-# input:
-frag_func = Function("vec4 $frag_color_input() { return $f_input; }")
-frag_func['f_input'] = ('varying', 'vec4')
-
-# Attach to the program
-program['fragment_color'] = frag_func
-
-# Next, we need a vertex shader function that will supply input
-# to the varying.
-vert_func = Function("void $vert_color_input() { $v_output = $v_input; }")
-colors = VertexBuffer(np.array([[1,1,1,1]], dtype=np.float32))
-vert_func['v_input'] = ('attribute', 'vec4', colors)
-
-# to ensure both the vertex function output and the fragment function input
-# are attached to the same varying, we use the following syntax:
-vert_func['v_output'] = frag_func['f_input']
-
-# and attach this to the vertex shader
-program['vert_post_hook'] = vert_func
-
-
-# obligatory: these variables are used to fill the text fields on the right.
-program._compile()
-VERTEX = program.vert_code
-FRAGMENT = program.frag_code
-'''),
-
-
- ('Sub-hooks', '''
-"""
-"""
-
-from vispy.visuals.shaders import (ModularProgram, Function, FunctionChain)
-from vispy.gloo import VertexBuffer
-import numpy as np
-
-vertex_shader = """
-void vert_post_hook();
-
-void main() {
- gl_Position = vec4(0,0,0,0);
- vert_post_hook();
-}
-"""
-
-fragment_shader = """
-void main() {
-}
-"""
-
-program = ModularProgram(vertex_shader, fragment_shader)
-
-# Create a function that calls another function
-vert_func = Function("""
-void $vert_func() {
- $some_other_function();
-}
-""")
-
-
-# Create the second function:
-other_func = Function("""
-void $other_func() {
- gl_Position.w = 1;
-}
-""")
-
-# Assign other_func to the anonymous function call in vert_func:
-vert_func['some_other_function'] = other_func
-
-# The name assigned to other_func will be inserted in place of
-# the function call in vert_func
-
-program['vert_post_hook'] = vert_func
-
-# obligatory: these variables are used to fill the text fields on the right.
-program._compile()
-VERTEX = program.vert_code
-FRAGMENT = program.frag_code
-'''),
-
-
-]
-
-
-qsci_note = """
-# [[ NOTE: Install PyQt.QsciScintilla for improved code editing ]]
-# [[ (Debian packages: python-qscintilla2 or python3-pyqt4.qsci ]]
-
-"""
-if not HAVE_QSCI:
- presets[0] = (presets[0][0], qsci_note + presets[0][1])
-
-
-app = QApplication([])
-
-win = QMainWindow()
-cw = QWidget()
-win.setCentralWidget(cw)
-layout = QGridLayout()
-cw.setLayout(layout)
-
-editor = Editor(language='Python')
-vertex = Editor(language='CPP')
-fragment = Editor(language='CPP')
-for i in range(3):
- editor.zoomOut()
- vertex.zoomOut()
- fragment.zoomOut()
-
-hsplit = QSplitter(QtCore.Qt.Horizontal)
-vsplit = QSplitter(QtCore.Qt.Vertical)
-
-layout.addWidget(hsplit)
-hsplit.addWidget(editor)
-hsplit.addWidget(vsplit)
-vsplit.addWidget(vertex)
-vsplit.addWidget(fragment)
-
-menubar = win.menuBar()
-
-last_loaded = -1
-
-
-def load_example(name):
- global last_loaded
- if isinstance(name, int):
- code = presets[name][1]
- editor.setText(code)
- last_loaded = name
- else:
- for i, preset in enumerate(presets):
- n, code = preset
- if n == name:
- editor.setText(code)
- last_loaded = i
- return
-
-
-def load_next():
- global last_loaded
- try:
- load_example(last_loaded+1)
- except IndexError:
- pass
-
-
-def mk_load_callback(name):
- return lambda: load_example(name)
-
-example_menu = menubar.addMenu('Load example..')
-for i, preset in enumerate(presets):
- name = preset[0]
- action = example_menu.addAction("%d. %s" % (i, name),
- mk_load_callback(name))
-
-next_action = menubar.addAction("Next example", load_next)
-
-win.show()
-win.resize(1800, 1100)
-hsplit.setSizes([900, 900])
-
-load_example(0)
-
-
-def update():
- code = editor.text()
- local = {}
- glob = {}
- try:
- exec(code, local, glob)
- vert = glob['VERTEX']
- frag = glob['FRAGMENT']
- editor.clear_marker()
- except Exception:
- vert = traceback.format_exc()
- frag = ""
- tb = sys.exc_info()[2]
- while tb is not None:
- #print(tb.tb_lineno, tb.tb_frame.f_code.co_filename)
- try:
- if tb.tb_frame.f_code.co_filename == '<string>':
- editor.set_marker(tb.tb_lineno-1)
- except Exception:
- pass
- tb = tb.tb_next
-
- vertex.setText(vert)
- fragment.setText(frag)
-
-editor.textChanged.connect(update)
-update()
-
-if __name__ == '__main__':
- app.exec_()
diff --git a/examples/basics/scene/nested_viewbox.py b/examples/basics/scene/nested_viewbox.py
deleted file mode 100644
index daf342f..0000000
--- a/examples/basics/scene/nested_viewbox.py
+++ /dev/null
@@ -1,151 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# vispy: gallery 2
-"""
-Simple test of nested viewboxes, demonstrating the three methods that
-can be used by a viewbox to provide clipping.
-
-In the root scene are two viewboxes: the left viewbox uses the 'viewport'
-clipping method and a PanZoomCamera, whereas the right viewbox uses the 'fbo'
-clipping method and a base Camera (null transform).
-
-Each of these viewboxes contains again two viewboxes, with the same
-differences. In this way we test embedding each type of viewbox inside each
-type.
-
-This is what it should look like:
-
-The plot line has a "marker" region on the left side that points in the +y
-direction. In pixel coordinates, this is normally expected to point downward
-(because the pixel y-axis points down). However, the default behavior for
-PanZoomCamera is to reverse its internal y-axis relative to its parent.
-
- +-----------------+-----------------+
- | | vb1 uses | | vb2 uses |
- | | PanZoomCamera | | base Camera |
- | | (+y upward) | | (+y downward) |
- +=================+=================+
- | | |
- | +y upward | +y upward |
- | | |
- +-----------------+-----------------+
- | | |
- | +y downward | +y downward |
- | | |
- +-----------------+-----------------+
-"""
-
-import numpy as np
-
-from vispy import app
-from vispy import scene
-
-#gloo.gl.use('desktop debug')
-
-# <<< Change method here
-# With the None method you can see the absence of clipping.
-# With the 'fbo' method you can see the texture interpolation (induced by
-# a delibirate mismatch in screen and textue resolution)
-# Try different combinarions, like a viewport in an fbo
-CLIP_METHOD1 = 'viewport' # none, viewport, fbo (fragment to come)
-CLIP_METHOD2 = 'fbo'
-
-
-# Create lines for use in ndc and pixel coordinates
-N = 1000
-color = np.ones((N, 4), dtype=np.float32)
-color[:, 0] = np.linspace(0, 1, N)
-color[:, 1] = color[::-1, 0]
-
-pos = np.empty((N, 2), np.float32)
-pos[:, 0] = np.linspace(0., 1., N)
-pos[:, 1] = np.random.normal(loc=0.5, scale=0.03, size=N)
-pos[N/2:N/2+20, 1] = 0.9 # So we can see which side is up
-
-
-# Create canvas
-canvas = scene.SceneCanvas(size=(800, 600), show=True, keys='interactive')
-
-#
-# Create viewboxes on left ...
-#
-
-w, h = canvas.size
-w2 = w / 2.
-h2 = h / 2.
-
-# left (+y up)
-vb1 = scene.widgets.ViewBox(parent=canvas.scene, name='vb1',
- margin=2, border_color='red')
-vb1.pos = 0, 0
-vb1.size = w2, h
-vb1.camera = 'panzoom'
-vb1.camera.rect = (0, 0, 1, 1)
-vb1.camera.interactive = False
-
-# bottom-left (+y down)
-vb11 = scene.widgets.ViewBox(parent=vb1.scene, name='vb11',
- margin=0.02, border_color='green')
-vb11.pos = 0, 0
-vb11.size = 1, 0.5
-vb11.camera = 'panzoom'
-vb11.camera.rect = (0, 0, 1, 1)
-line11 = scene.visuals.Line(pos=pos, color=color, method='gl',
- parent=vb11.scene)
-
-# top-left (+y up)
-vb12 = scene.widgets.ViewBox(parent=vb1.scene, name='vb12',
- margin=0.02, border_color='blue')
-vb12.pos = 0, 0.5
-vb12.size = 1, 0.5
-vb12.camera = 'base' # use parent cs
-# vb12 does not apply any scaling, so we do that manually here to match vb11
-line12 = scene.visuals.Line(pos=pos * [[1.0, 0.5]], color=color, method='gl',
- parent=vb12.scene)
-
-
-#
-# Create viewboxes on right ...
-#
-
-# right (+y down)
-vb2 = scene.widgets.ViewBox(parent=canvas.scene, name='vb2',
- margin=2, border_color='yellow')
-vb2.pos = w2, 0
-vb2.size = w2, h
-vb2.camera = 'base'
-vb2.camera.interactive = False
-
-# top-right (+y up)
-vb21 = scene.widgets.ViewBox(parent=vb2.scene, name='vb21',
- margin=10, border_color='purple')
-vb21.pos = 0, 0
-vb21.size = w2, h2
-vb21.camera = 'panzoom'
-vb21.camera.rect = (0, 0, 1, 1)
-line21 = scene.visuals.Line(pos=pos, color=color, method='gl',
- parent=vb21.scene)
-
-# bottom-right (+y down)
-vb22 = scene.widgets.ViewBox(parent=vb2.scene, name='vb22',
- margin=10, border_color='teal')
-vb22.pos = 0, h2
-vb22.size = w2, h2
-vb22.camera = 'base' # use parent cs
-# vb22 does not apply any scaling, so we do that manually here to match vb21
-line22 = scene.visuals.Line(pos=pos * [[w2, h2]], color=color, method='gl',
- parent=vb22.scene)
-
-
-# Set preferred clipping methods
-for vb in [vb1, vb11, vb21]:
- vb.clip_method = CLIP_METHOD1
-for vb in [vb2, vb12, vb22]:
- vb.clip_method = CLIP_METHOD2
-
-
-if __name__ == '__main__':
- app.run()
diff --git a/examples/basics/scene/one_cam_two_scenes.py b/examples/basics/scene/one_cam_two_scenes.py
deleted file mode 100644
index 95c9d4a..0000000
--- a/examples/basics/scene/one_cam_two_scenes.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# vispy: gallery 2
-
-"""
-Demonstrating two scenes that share the same camera view by linking the
-cameras.
-"""
-
-import numpy as np
-
-from vispy import app, scene, io
-
-canvas = scene.SceneCanvas(keys='interactive')
-canvas.size = 800, 600
-canvas.show()
-
-# Create two ViewBoxes, place side-by-side
-vb1 = scene.widgets.ViewBox(border_color='yellow', parent=canvas.scene)
-vb2 = scene.widgets.ViewBox(border_color='blue', parent=canvas.scene)
-#
-grid = canvas.central_widget.add_grid()
-grid.padding = 6
-grid.add_widget(vb1, 0, 0)
-grid.add_widget(vb2, 0, 1)
-
-# Create the image
-im1 = io.load_crate().astype('float32') / 255
-# Make gray, smooth, and take derivatives: edge enhancement
-im2 = im1[:, :, 1]
-im2 = (im2[1:-1, 1:-1] + im2[0:-2, 1:-1] + im2[2:, 1:-1] +
- im2[1:-1, 0:-2] + im2[1:-1, 2:]) / 5
-im2 = 0.5 + (np.abs(im2[0:-2, 1:-1] - im2[1:-1, 1:-1]) +
- np.abs(im2[1:-1, 0:-2] - im2[1:-1, 1:-1]))
-
-image1 = scene.visuals.Image(im1, parent=vb1.scene)
-image2 = scene.visuals.Image(im2, parent=vb2.scene)
-
-# Set 2D camera (PanZoomCamera, TurnTableCamera)
-vb1.camera, vb2.camera = scene.PanZoomCamera(), scene.PanZoomCamera()
-vb1.camera.aspect = vb2.camera.aspect = 1 # no auto-scale
-vb1.camera.link(vb2.camera)
-
-# Set the view bounds to show the entire image with some padding
-#view.camera.rect = (-10, -10, image.size[0]+20, image.size[1]+20)
-
-if __name__ == '__main__':
- app.run()
diff --git a/examples/basics/scene/one_scene_four_cams.py b/examples/basics/scene/one_scene_four_cams.py
deleted file mode 100644
index a5726ca..0000000
--- a/examples/basics/scene/one_scene_four_cams.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# vispy: gallery 2
-
-"""
-Demonstrating a single scene that is shown in four different viewboxes,
-each with a different camera.
-"""
-
-# todo: the panzoom camera sometimes work, sometimes not. Not sure why.
-# we should probably make iterating over children deterministic, so that
-# an error like this becomes easier to reproduce ...
-
-import sys
-
-from vispy import app, scene, io
-
-canvas = scene.SceneCanvas(keys='interactive')
-canvas.size = 800, 600
-canvas.show()
-
-# Create two ViewBoxes, place side-by-side
-vb1 = scene.widgets.ViewBox(border_color='white', parent=canvas.scene)
-vb2 = scene.widgets.ViewBox(border_color='white', parent=canvas.scene)
-vb3 = scene.widgets.ViewBox(border_color='white', parent=canvas.scene)
-vb4 = scene.widgets.ViewBox(border_color='white', parent=canvas.scene)
-scenes = vb1.scene, vb2.scene, vb3.scene, vb4.scene
-
-# Put viewboxes in a grid
-grid = canvas.central_widget.add_grid()
-grid.padding = 6
-grid.add_widget(vb1, 0, 0)
-grid.add_widget(vb2, 0, 1)
-grid.add_widget(vb3, 1, 0)
-grid.add_widget(vb4, 1, 1)
-
-# Create some visuals to show
-# AK: Ideally, we could just create one visual that is present in all
-# scenes, but that results in flicker for the PanZoomCamera, I suspect
-# due to errors in transform caching.
-im1 = io.load_crate().astype('float32') / 255
-#image1 = scene.visuals.Image(im1, grid=(20, 20), parent=scenes)
-for par in scenes:
- image = scene.visuals.Image(im1, grid=(20, 20), parent=par)
-
-#vol1 = np.load(io.load_data_file('volume/stent.npz'))['arr_0']
-#volume1 = scene.visuals.Volume(vol1, parent=scenes)
-#volume1.transform = scene.STTransform(translate=(0, 0, 10))
-
-# Assign cameras
-vb1.camera = scene.BaseCamera()
-vb2.camera = scene.PanZoomCamera()
-vb3.camera = scene.TurntableCamera()
-vb4.camera = scene.FlyCamera()
-
-
-# If True, show a cuboid at each camera
-if False:
- cube = scene.visuals.Cube((3, 3, 5))
- cube.transform = scene.STTransform(translate=(0, 0, 6))
- for vb in (vb1, vb2, vb3, vb4):
- vb.camera.parents = scenes
- cube.add_parent(vb.camera)
-
-if __name__ == '__main__':
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/basics/scene/sensitivity.py b/examples/basics/scene/sensitivity.py
deleted file mode 100644
index 0219aa3..0000000
--- a/examples/basics/scene/sensitivity.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-# For testing zoom sensitivity on various platforms
-
-import numpy as np
-import vispy.scene
-from vispy.scene import visuals
-
-canvas = vispy.scene.SceneCanvas(keys='interactive', show=True)
-vb = canvas.central_widget.add_view()
-vb.camera = 'panzoom'
-vb.camera.rect = (-10, -10, 20, 20)
-
-centers = np.random.normal(size=(50, 2))
-pos = np.random.normal(size=(100000, 2), scale=0.2)
-indexes = np.random.normal(size=100000, loc=centers.shape[0]/2.,
- scale=centers.shape[0]/3.)
-indexes = np.clip(indexes, 0, centers.shape[0]-1).astype(int)
-scales = 10**(np.linspace(-2, 0.5, centers.shape[0]))[indexes][:, np.newaxis]
-pos *= scales
-pos += centers[indexes]
-
-scatter = visuals.Markers()
-scatter.set_gl_state('translucent', depth_test=False)
-scatter.set_data(pos, edge_width=0, face_color=(1, 1, 1, 0.3), size=5)
-vb.add(scatter)
-
-
- at canvas.connect
-def on_key_press(ev):
- if ev.key.name in '+=':
- vb.camera.zoom_factor *= 1.1
- elif ev.key.name == '-':
- vb.camera.zoom_factor /= 1.1
- print("Zoom factor: %0.4f" % vb.camera.zoom_factor)
-
-
-if __name__ == '__main__':
- import sys
- if sys.flags.interactive != 1:
- vispy.app.run()
diff --git a/examples/basics/scene/shared_context.py b/examples/basics/scene/shared_context.py
deleted file mode 100644
index 3df3095..0000000
--- a/examples/basics/scene/shared_context.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-This example demonstrates the use of multiple canvases with visuals shared
-between them.
-"""
-
-import sys
-import numpy as np
-
-from vispy import app, scene
-from vispy.util.filter import gaussian_filter
-
-
-canvas1 = scene.SceneCanvas(keys='interactive', show=True)
-view1 = canvas1.central_widget.add_view()
-view1.camera = scene.TurntableCamera(fov=60)
-
-canvas2 = scene.SceneCanvas(keys='interactive', show=True,
- shared=canvas1.context)
-view2 = canvas2.central_widget.add_view()
-view2.camera = 'panzoom'
-
-# Simple surface plot example
-# x, y values are not specified, so assumed to be 0:50
-z = gaussian_filter(np.random.normal(size=(50, 50)), (1, 1)) * 10
-p1 = scene.visuals.SurfacePlot(z=z, color=(0.5, 0.5, 1, 1), shading='smooth')
-p1.transform = scene.transforms.AffineTransform()
-p1.transform.scale([1/49., 1/49., 0.02])
-p1.transform.translate([-0.5, -0.5, 0])
-
-view1.add(p1)
-view2.add(p1)
-
-# Add a 3D axis to keep us oriented
-axis = scene.visuals.XYZAxis(parent=view1.scene)
-
-canvas = canvas1 # allow running this example in our test suite
-
-if __name__ == '__main__':
- if sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/stereo.py b/examples/basics/scene/stereo.py
deleted file mode 100644
index e1b9b76..0000000
--- a/examples/basics/scene/stereo.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-
-"""
-Example demonstrating stereo vision in a scene has an anisotropic aspect
-ratio. This example can be used to test that the cameras behave
-correctly with nested translated/rotated cameras.
-"""
-
-import numpy as np
-
-from vispy import app, scene, io
-
-# Read volume
-vol1 = np.load(io.load_data_file('volume/stent.npz'))['arr_0']
-
-# Prepare canvas
-canvas = scene.SceneCanvas(keys='interactive')
-canvas.size = 800, 600
-canvas.show()
-canvas.measure_fps()
-
-# Set up a viewbox to display the image with interactive pan/zoom
-# Create two ViewBoxes, place side-by-side
-vb1 = scene.widgets.ViewBox(border_color='yellow', parent=canvas.scene)
-vb2 = scene.widgets.ViewBox(border_color='blue', parent=canvas.scene)
-
-# This is temporarily needed because fragment clipping method is not yet
-# compatible with multiple parenting.
-vb1.clip_method = 'viewport'
-vb2.clip_method = 'viewport'
-
-scenes = vb1.scene, vb2.scene
-#
-grid = canvas.central_widget.add_grid()
-grid.padding = 6
-grid.add_widget(vb1, 0, 0)
-grid.add_widget(vb2, 0, 1)
-
-# Create the volume visuals, only one is visible
-volume1 = scene.visuals.Volume(vol1, parent=scenes, threshold=0.5)
-
-# Create cameras. The second is a child of the first, thus inheriting
-# its transform.
-cam1 = scene.cameras.TurntableCamera(parent=scenes, fov=60)
-cam2 = scene.cameras.PerspectiveCamera(parent=cam1, fov=60)
-#
-cam2.transform.translate((+10, 0, 0))
-
-vb1.camera = cam1
-vb2.camera = cam2
-
-if __name__ == '__main__':
- app.run()
diff --git a/examples/basics/scene/surface_plot.py b/examples/basics/scene/surface_plot.py
deleted file mode 100644
index 09e06dc..0000000
--- a/examples/basics/scene/surface_plot.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-This example demonstrates the use of the SurfacePlot visual.
-"""
-
-import sys
-import numpy as np
-
-from vispy import app, scene
-from vispy.util.filter import gaussian_filter
-
-
-canvas = scene.SceneCanvas(keys='interactive')
-view = canvas.central_widget.add_view()
-view.camera = scene.TurntableCamera(up='z')
-
-# Simple surface plot example
-# x, y values are not specified, so assumed to be 0:50
-z = gaussian_filter(np.random.normal(size=(50, 50)), (1, 1)) * 10
-p1 = scene.visuals.SurfacePlot(z=z, color=(0.5, 0.5, 1, 1), shading='smooth')
-p1.transform = scene.transforms.AffineTransform()
-p1.transform.scale([1/49., 1/49., 0.02])
-p1.transform.translate([-0.5, -0.5, 0])
-
-view.add(p1)
-
-# Add a 3D axis to keep us oriented
-axis = scene.visuals.XYZAxis(parent=view.scene)
-
-if __name__ == '__main__':
- canvas.show()
- if sys.flags.interactive == 0:
- app.run()
diff --git a/examples/basics/scene/text.py b/examples/basics/scene/text.py
deleted file mode 100644
index 5315edd..0000000
--- a/examples/basics/scene/text.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-
-"""
-Demonstrate the use of text in the root scene and a viewbox. Note
-how the point size is independent of scaling of viewbox and canvas.
-"""
-import sys
-import numpy as np
-
-from vispy import scene
-from vispy.scene.visuals import Text
-
-# Create canvas with a viewbox at the lower half
-canvas = scene.SceneCanvas(keys='interactive')
-vb = scene.widgets.ViewBox(parent=canvas.scene, border_color='b')
-vb.camera = scene.TurntableCamera(elevation=30, azimuth=30, up='+z')
-axis = scene.visuals.XYZAxis(parent=vb.scene)
-vb.camera.rect = 0, 0, 1, 1
-
-
- at canvas.events.resize.connect
-def resize(event=None):
- vb.pos = 1, canvas.size[1] // 2 - 1
- vb.size = canvas.size[0] - 2, canvas.size[1] // 2 - 2
-
-t1 = Text('Text in root scene (24 pt)', parent=canvas.scene, color='red')
-t1.font_size = 24
-t1.pos = canvas.size[0] // 2, canvas.size[1] // 3
-
-t2 = Text('Text in viewbox (18 pt)', parent=vb.scene, color='green',
- rotation=30)
-t2.font_size = 18
-t2.pos = 0.5, 0.3
-
-# Add a line so you can see translate/scale of camera
-N = 1000
-linedata = np.empty((N, 2), np.float32)
-linedata[:, 0] = np.linspace(0, 1, N)
-linedata[:, 1] = np.random.uniform(0.5, 0.1, (N,))
-scene.visuals.Line(pos=linedata, color='#f006', method='gl', parent=vb.scene)
-
-if __name__ == '__main__':
- canvas.show()
- if sys.flags.interactive != 1:
- canvas.app.run()
diff --git a/examples/basics/scene/viewbox.py b/examples/basics/scene/viewbox.py
deleted file mode 100644
index 900206f..0000000
--- a/examples/basics/scene/viewbox.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Demonstrate ViewBox using various clipping methods.
-"""
-import sys
-import numpy as np
-
-from vispy import app
-from vispy import scene
-
-
-# Create canvas
-canvas = scene.SceneCanvas(size=(800, 600), show=True, keys='interactive')
-grid = canvas.central_widget.add_grid()
-
-# Create two ViewBoxes, place side-by-side
-vb1 = grid.add_view(name='vb1', border_color='yellow')
-# Viewboxes can use one of 3 different clipping methods: 'fragment',
-# 'viewport', or 'fbo'. The default is 'fragment', which does all clipping in
-# the fragment shader.
-vb1.clip_method = 'fragment'
-# First ViewBox uses a 2D pan/zoom camera
-vb1.camera = 'panzoom'
-
-# Second ViewBox uses a 3D perspective camera
-vb2 = grid.add_view(name='vb2', border_color='yellow')
-vb2.parent = canvas.scene
-# Second ViewBox uses glViewport to implement clipping and a 3D turntable
-# camera.
-vb2.clip_method = 'viewport'
-vb2.camera = scene.TurntableCamera(elevation=30, azimuth=30, up='+y')
-
-
-#
-# Now add visuals to the viewboxes.
-#
-
-# First a plot line:
-N = 1000
-color = np.ones((N, 4), dtype=np.float32)
-color[:, 0] = np.linspace(0, 1, N)
-color[:, 1] = color[::-1, 0]
-
-pos = np.empty((N, 2), np.float32)
-pos[:, 0] = np.linspace(-1., 1., N)
-pos[:, 1] = np.random.normal(0.0, 0.5, size=N)
-pos[:20, 1] = -0.5 # So we can see which side is down
-
-# make a single plot line and display in both viewboxes
-line1 = scene.visuals.Line(pos=pos.copy(), color=color, method='gl',
- antialias=False, name='line1', parent=vb1.scene)
-line2 = scene.visuals.Line(pos=pos.copy(), color=color, method='gl',
- antialias=False, name='line1', parent=vb2.scene)
-
-
-# And some squares:
-box = np.array([[0, 0, 0],
- [0, 1, 0],
- [1, 1, 0],
- [1, 0, 0],
- [0, 0, 0]], dtype=np.float32)
-z = np.array([[0, 0, 1]], dtype=np.float32)
-
-# First two boxes are added to both views
-box1 = scene.visuals.Line(pos=box, color=(0.7, 0, 0, 1), method='gl',
- name='unit box', parent=vb1.scene)
-box2 = scene.visuals.Line(pos=box, color=(0.7, 0, 0, 1), method='gl',
- name='unit box', parent=vb2.scene)
-
-box2 = scene.visuals.Line(pos=(box * 2 - 1), color=(0, 0.7, 0, 1),
- method='gl', name='nd box', parent=vb1.scene)
-box3 = scene.visuals.Line(pos=(box * 2 - 1), color=(0, 0.7, 0, 1),
- method='gl', name='nd box', parent=vb2.scene)
-
-# These boxes are only added to the 3D view.
-box3 = scene.visuals.Line(pos=box + z, color=(1, 0, 0, 1),
- method='gl', name='unit box', parent=vb2.scene)
-box5 = scene.visuals.Line(pos=((box + z) * 2 - 1), color=(0, 1, 0, 1),
- method='gl', name='nd box', parent=vb2.scene)
-
-
-if __name__ == '__main__' and sys.flags.interactive == 0:
- print(canvas.scene.describe_tree(with_transform=True))
- app.run()
diff --git a/examples/basics/scene/volume.py b/examples/basics/scene/volume.py
deleted file mode 100644
index 2391991..0000000
--- a/examples/basics/scene/volume.py
+++ /dev/null
@@ -1,133 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# vispy: gallery 2
-
-"""
-Example volume rendering
-
-Controls:
-
-* 1 - toggle camera between first person (fly) and regular 3D (turntable)
-* 2 - toggle between volume rendering methods
-* 3 - toggle between stent-CT / brain-MRI image
-* 4 - toggle between colormaps
-* 0 - reset cameras
-* [] - decrease/increase isosurface threshold
-
-With fly camera:
-
-* WASD or arrow keys - move around
-* SPACE - brake
-* FC - move up-down
-* IJKL or mouse - look around
-"""
-
-from itertools import cycle
-
-import numpy as np
-
-from vispy import app, scene, io
-from vispy.color import get_colormaps, BaseColormap
-
-# Read volume
-vol1 = np.load(io.load_data_file('volume/stent.npz'))['arr_0']
-vol2 = np.load(io.load_data_file('brain/mri.npz'))['data']
-vol2 = np.flipud(np.rollaxis(vol2, 1))
-
-# Prepare canvas
-canvas = scene.SceneCanvas(keys='interactive', size=(800, 600), show=True)
-canvas.measure_fps()
-
-# Set up a viewbox to display the image with interactive pan/zoom
-view = canvas.central_widget.add_view()
-
-# Set whether we are emulating a 3D texture
-emulate_texture = False
-
-# Create the volume visuals, only one is visible
-volume1 = scene.visuals.Volume(vol1, parent=view.scene, threshold=0.225,
- emulate_texture=emulate_texture)
-volume1.transform = scene.STTransform(translate=(64, 64, 0))
-volume2 = scene.visuals.Volume(vol2, parent=view.scene, threshold=0.2,
- emulate_texture=emulate_texture)
-volume2.visible = False
-
-# Create two cameras (1 for firstperson, 3 for 3d person)
-fov = 60.
-cam1 = scene.cameras.FlyCamera(parent=view.scene, fov=fov)
-cam2 = scene.cameras.TurntableCamera(parent=view.scene, fov=fov)
-cam3 = scene.cameras.ArcballCamera(parent=view.scene, fov=fov)
-view.camera = cam2 # Select turntable at first
-
-
-# create colormaps that work well for translucent and additive volume rendering
-class TransFire(BaseColormap):
- glsl_map = """
- vec4 translucent_fire(float t) {
- return vec4(pow(t, 0.5), t, t*t, max(0, t*1.05 - 0.05));
- }
- """
-
-
-class TransGrays(BaseColormap):
- glsl_map = """
- vec4 translucent_grays(float t) {
- return vec4(t, t, t, t*0.05);
- }
- """
-
-# Setup colormap iterators
-opaque_cmaps = cycle(get_colormaps())
-translucent_cmaps = cycle([TransFire(), TransGrays()])
-opaque_cmap = next(opaque_cmaps)
-translucent_cmap = next(translucent_cmaps)
-
-
-# Implement key presses
- at canvas.events.key_press.connect
-def on_key_press(event):
- global opaque_cmap, translucent_cmap
- if event.text == '1':
- cam_toggle = {cam1: cam2, cam2: cam3, cam3: cam1}
- view.camera = cam_toggle.get(view.camera, 'fly')
- elif event.text == '2':
- methods = ['mip', 'translucent', 'iso', 'additive']
- method = methods[(methods.index(volume1.method) + 1) % 4]
- print("Volume render method: %s" % method)
- cmap = opaque_cmap if method in ['mip', 'iso'] else translucent_cmap
- volume1.method = method
- volume1.cmap = cmap
- volume2.method = method
- volume2.cmap = cmap
- elif event.text == '3':
- volume1.visible = not volume1.visible
- volume2.visible = not volume1.visible
- elif event.text == '4':
- if volume1.method in ['mip', 'iso']:
- cmap = opaque_cmap = next(opaque_cmaps)
- else:
- cmap = translucent_cmap = next(translucent_cmaps)
- volume1.cmap = cmap
- volume2.cmap = cmap
- elif event.text == '0':
- cam1.set_range()
- cam3.set_range()
- elif event.text != '' and event.text in '[]':
- s = -0.025 if event.text == '[' else 0.025
- volume1.threshold += s
- volume2.threshold += s
- th = volume1.threshold if volume1.visible else volume2.threshold
- print("Isosurface threshold: %0.3f" % th)
-
-
-# for testing performance
-#@canvas.connect
-#def on_draw(ev):
- #canvas.update()
-
-if __name__ == '__main__':
- print(__doc__)
- app.run()
diff --git a/examples/basics/visuals/arcball.py b/examples/basics/visuals/arcball.py
deleted file mode 100644
index 2d785df..0000000
--- a/examples/basics/visuals/arcball.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Demonstration of how to interact with visuals, here with simple
-arcball-style control.
-"""
-
-import sys
-import numpy as np
-
-from vispy import app, gloo
-from vispy.visuals import CubeVisual, transforms
-from vispy.util.quaternion import Quaternion
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, 'Cube', keys='interactive',
- size=(400, 400))
-
- self.cube = CubeVisual((1.0, 0.5, 0.25), color='red',
- edge_color='black')
- self.quaternion = Quaternion()
-
- # Create a TransformSystem that will tell the visual how to draw
- self.cube_transform = transforms.AffineTransform()
- self.cube_transform.scale((100, 100, 0.001))
- self.cube_transform.translate((200, 200))
- self.tr_sys = transforms.TransformSystem(self)
- self.tr_sys.visual_to_document = self.cube_transform
- self.show()
-
- def on_draw(self, event):
- gloo.set_viewport(0, 0, *self.physical_size)
- gloo.clear('white')
- self.tr_sys.auto_configure()
- self.cube.draw(self.tr_sys)
-
- def on_mouse_move(self, event):
- if event.button == 1 and event.last_event is not None:
- x0, y0 = event.last_event.pos
- x1, y1 = event.pos
- w, h = self.size
- self.quaternion = (self.quaternion *
- Quaternion(*_arcball(x0, y0, w, h)) *
- Quaternion(*_arcball(x1, y1, w, h)))
- self.cube_transform.matrix = self.quaternion.get_matrix()
- self.cube_transform.scale((100, 100, 0.001))
- self.cube_transform.translate((200, 200))
- self.update()
-
-
-def _arcball(x, y, w, h):
- """Convert x,y coordinates to w,x,y,z Quaternion parameters
-
- Adapted from:
-
- linalg library
-
- Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com>
- Licence at your convenience:
- GPLv3 or higher <http://www.gnu.org/licenses/gpl.html>
- BSD new <http://opensource.org/licenses/BSD-3-Clause>
- """
- r = (w + h) / 2.
- x, y = -(2. * x - w) / r, -(2. * y - h) / r
- h = np.sqrt(x*x + y*y)
- return (0., x/h, y/h, 0.) if h > 1. else (0., x, y, np.sqrt(1. - h*h))
-
-if __name__ == '__main__':
- win = Canvas()
- win.show()
- if sys.flags.interactive != 1:
- win.app.run()
diff --git a/examples/basics/visuals/cube.py b/examples/basics/visuals/cube.py
deleted file mode 100644
index 6e1d2da..0000000
--- a/examples/basics/visuals/cube.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Demonstration of Cube
-"""
-
-import sys
-
-from vispy import app, gloo
-from vispy.visuals import CubeVisual, transforms
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, 'Cube', keys='interactive',
- size=(400, 400))
-
- self.cube = CubeVisual((1.0, 0.5, 0.25), color='red',
- edge_color='black')
- self.theta = 0
- self.phi = 0
-
- # Create a TransformSystem that will tell the visual how to draw
- self.cube_transform = transforms.AffineTransform()
- self.tr_sys = transforms.TransformSystem(self)
- self.tr_sys.visual_to_document = self.cube_transform
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def on_draw(self, event):
- gloo.set_viewport(0, 0, *self.physical_size)
- gloo.clear('white')
- self.tr_sys.auto_configure()
- self.cube.draw(self.tr_sys)
-
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- self.cube_transform.reset()
- self.cube_transform.rotate(self.theta, (0, 0, 1))
- self.cube_transform.rotate(self.phi, (0, 1, 0))
- self.cube_transform.scale((100, 100, 0.001))
- self.cube_transform.translate((200, 200))
- self.update()
-
-if __name__ == '__main__':
- win = Canvas()
- win.show()
- if sys.flags.interactive != 1:
- win.app.run()
diff --git a/examples/basics/visuals/custom_visual.py b/examples/basics/visuals/custom_visual.py
deleted file mode 100644
index bf82130..0000000
--- a/examples/basics/visuals/custom_visual.py
+++ /dev/null
@@ -1,152 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-from __future__ import division
-import numpy as np
-
-from vispy import app
-from vispy import gloo
-from vispy.visuals.shaders import ModularProgram
-from vispy.visuals import Visual
-from vispy.visuals.transforms import (STTransform, LogTransform,
- TransformSystem, ChainTransform)
-
-
-class MarkerVisual(Visual):
- # My full vertex shader, with just a `transform` hook.
- VERTEX_SHADER = """
- #version 120
-
- attribute vec2 a_position;
- attribute vec3 a_color;
- attribute float a_size;
-
- varying vec4 v_fg_color;
- varying vec4 v_bg_color;
- varying float v_radius;
- varying float v_linewidth;
- varying float v_antialias;
-
- void main (void) {
- v_radius = a_size;
- v_linewidth = 1.0;
- v_antialias = 1.0;
- v_fg_color = vec4(0.0,0.0,0.0,0.5);
- v_bg_color = vec4(a_color, 1.0);
-
- gl_Position = $transform(vec4(a_position,0,1));
-
- gl_PointSize = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);
- }
- """
-
- FRAGMENT_SHADER = """
- #version 120
- varying vec4 v_fg_color;
- varying vec4 v_bg_color;
- varying float v_radius;
- varying float v_linewidth;
- varying float v_antialias;
- void main()
- {
- float size = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);
- float t = v_linewidth/2.0-v_antialias;
- float r = length((gl_PointCoord.xy - vec2(0.5,0.5))*size);
- float d = abs(r - v_radius) - t;
- if( d < 0.0 )
- gl_FragColor = v_fg_color;
- else
- {
- float alpha = d/v_antialias;
- alpha = exp(-alpha*alpha);
- if (r > v_radius)
- gl_FragColor = vec4(v_fg_color.rgb, alpha*v_fg_color.a);
- else
- gl_FragColor = mix(v_bg_color, v_fg_color, alpha);
- }
- }
- """
-
- def __init__(self, pos=None, color=None, size=None):
- self._program = ModularProgram(self.VERTEX_SHADER,
- self.FRAGMENT_SHADER)
- self.set_data(pos=pos, color=color, size=size)
-
- def set_options(self):
- """Special function that is used to set the options. Automatically
- called at initialization."""
- gloo.set_state(clear_color=(1, 1, 1, 1), blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- def set_data(self, pos=None, color=None, size=None):
- """I'm not required to use this function. We could also have a system
- of trait attributes, such that a user doing
- `visual.position = myndarray` results in an automatic update of the
- buffer. Here I just set the buffers manually."""
- self._pos = pos
- self._color = color
- self._size = size
-
- def draw(self, transforms):
- # attributes / uniforms are not available until program is built
- tr = transforms.get_full_transform()
- self._program.vert['transform'] = tr.shader_map()
- self._program.prepare() # Force ModularProgram to set shaders
- self._program['a_position'] = gloo.VertexBuffer(self._pos)
- self._program['a_color'] = gloo.VertexBuffer(self._color)
- self._program['a_size'] = gloo.VertexBuffer(self._size)
- self._program.draw('points')
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
- ps = self.pixel_scale
-
- n = 10000
- pos = 0.25 * np.random.randn(n, 2).astype(np.float32)
- color = np.random.uniform(0, 1, (n, 3)).astype(np.float32)
- size = np.random.uniform(2*ps, 12*ps, (n, 1)).astype(np.float32)
-
- self.points = MarkerVisual(pos=pos, color=color, size=size)
-
- self.panzoom = STTransform(scale=(1, 0.2), translate=(0, 500))
- w2 = (self.size[0]/2, self.size[1]/2)
- self.transform = ChainTransform([self.panzoom,
- STTransform(scale=w2, translate=w2),
- LogTransform(base=(0, 2, 0))])
-
- self.tr_sys = TransformSystem(self)
- self.tr_sys.visual_to_document = self.transform
-
- gloo.set_state(blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- def on_mouse_move(self, event):
- if event.is_dragging:
- dxy = event.pos - event.last_event.pos
- button = event.press_event.button
-
- if button == 1:
- self.panzoom.move(dxy)
- elif button == 2:
- center = event.press_event.pos
- self.panzoom.zoom(np.exp(dxy * (0.01, -0.01)), center)
-
- self.update()
-
- def on_resize(self, event):
- self.width, self.height = event.size
- gloo.set_viewport(0, 0, self.width, self.height)
-
- def on_draw(self, event):
- gloo.clear()
- self.points.draw(self.tr_sys)
-
-if __name__ == '__main__':
- c = Canvas()
- c.show()
- app.run()
diff --git a/examples/basics/visuals/dynamic_polygon.py b/examples/basics/visuals/dynamic_polygon.py
deleted file mode 100644
index 021a5cf..0000000
--- a/examples/basics/visuals/dynamic_polygon.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Demonstration of Polygon and subclasses
-"""
-
-import sys
-import numpy as np
-
-from vispy import app, gloo, visuals
-from vispy.visuals import transforms
-
-# vertex positions of polygon data to draw
-pos = np.array([[0, 0, 0],
- [0.25, 0.22, 0],
- [0.25, 0.5, 0],
- [0, 0.5, 0],
- [-0.25, 0.25, 0]])
-
-pos = np.array([[0, 0],
- [10, 0],
- [10, 10],
- [20, 10],
- [20, 20],
- [25, 20],
- [25, 25],
- [20, 25],
- [20, 20],
- [10, 17],
- [5, 25],
- [9, 30],
- [6, 15],
- [15, 12.5],
- [0, 5]])
-
-theta = np.linspace(0, 2*np.pi, 11)
-pos = np.hstack([np.cos(theta)[:, np.newaxis],
- np.sin(theta)[:, np.newaxis]])
-pos[::2] *= 0.4
-pos[-1] = pos[0]
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 800))
- global pos
- self.visuals = []
- polygon = visuals.PolygonVisual(pos=pos, color=(0.8, .2, 0, 1),
- border_color=(1, 1, 1, 1))
- polygon.transform = transforms.STTransform(scale=(200, 200),
- translate=(600, 600))
- self.visuals.append(polygon)
-
- ellipse = visuals.EllipseVisual(pos=(0, 0, 0), radius=(100, 100),
- color=(0.2, 0.2, 0.8, 1),
- border_color=(1, 1, 1, 1),
- start_angle=180., span_angle=150.)
- ellipse.transform = transforms.STTransform(scale=(0.9, 1.5),
- translate=(200, 200))
- self.visuals.append(ellipse)
-
- rect = visuals.RectangleVisual(pos=(600, 200, 0), height=200.,
- width=300.,
- radius=[30., 30., 0., 0.],
- color=(0.5, 0.5, 0.2, 1),
- border_color='white')
- rect.transform = transforms.NullTransform()
- self.visuals.append(rect)
-
- rpolygon = visuals.RegularPolygonVisual(pos=(200., 600., 0),
- radius=160,
- color=(0.2, 0.8, 0.2, 1),
- border_color=(1, 1, 1, 1),
- sides=6)
- rpolygon.transform = transforms.NullTransform()
- self.visuals.append(rpolygon)
-
- for v in self.visuals:
- v.tr_sys = transforms.TransformSystem(self)
- v.tr_sys.visual_to_document = v.transform
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def on_draw(self, ev):
- gloo.set_clear_color((0, 0, 0, 1))
- gloo.set_viewport(0, 0, *self.physical_size)
- gloo.clear()
- for vis in self.visuals:
- vis.draw(vis.tr_sys)
-
- def on_timer(self, event):
- polygon, ellipse, rect, rpolygon = self.visuals
- r = ellipse.radius
- ellipse.radius = r[0], r[1] + np.sin(event.elapsed * 10)
- ellipse.span_angle = (ellipse.span_angle + 100. * event.dt) % 360
-
- polygon.color = (0.3 * (0.5 + np.sin(event.elapsed*2 + 0)),
- 0.3 * (0.5 + np.sin(event.elapsed*2 + np.pi * 2./3.)),
- 0.3 * (0.5 + np.sin(event.elapsed*2 + np.pi * 4./3.)),
- )
- polygon.border_color = (.8, .8, .8,
- 0.5 + (0.5 * np.sin(event.elapsed*10)))
-
- rpolygon.radius = 100 + 10 * np.sin(event.elapsed * 3.1)
- rpolygon.sides = int(20 + 17 * np.sin(event.elapsed))
-
- self.update()
-
-
-if __name__ == '__main__':
- win = Canvas()
- if sys.flags.interactive != 1:
- win.app.run()
diff --git a/examples/basics/visuals/image_transforms.py b/examples/basics/visuals/image_transforms.py
deleted file mode 100644
index b9573a5..0000000
--- a/examples/basics/visuals/image_transforms.py
+++ /dev/null
@@ -1,123 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# vispy: gallery 2
-
-"""
-Simple demonstration of ImageVisual.
-"""
-
-import numpy as np
-import vispy.app
-from vispy import gloo
-from vispy import visuals
-from vispy.visuals.transforms import (AffineTransform, STTransform,
- arg_to_array, TransformSystem,
- LogTransform, PolarTransform,
- BaseTransform)
-
-image = np.random.normal(size=(100, 100, 3))
-image[20:80, 20:80] += 3.
-image[50] += 3.
-image[:, 50] += 3.
-
-image = ((image-image.min()) *
- (253. / (image.max()-image.min()))).astype(np.ubyte)
-
-
-class Canvas(vispy.app.Canvas):
- def __init__(self):
- vispy.app.Canvas.__init__(self, keys='interactive', size=(800, 800))
-
- self.images = [visuals.ImageVisual(image, method='impostor')
- for i in range(4)]
- self.images[0].transform = (STTransform(scale=(30, 30),
- translate=(600, 600)) *
- SineTransform() *
- STTransform(scale=(0.1, 0.1),
- translate=(-5, -5)))
-
- tr = AffineTransform()
- tr.rotate(30, (0, 0, 1))
- tr.rotate(40, (0, 1, 0))
- tr.scale((3, 3))
- self.images[1].transform = (STTransform(translate=(200, 600)) *
- tr *
- STTransform(translate=(-50, -50)))
-
- self.images[2].transform = (STTransform(scale=(3, -150),
- translate=(200, 100)) *
- LogTransform((0, 2, 0)) *
- STTransform(scale=(1, -0.01),
- translate=(-50, 1.3)))
-
- self.images[3].transform = (STTransform(scale=(400, 400),
- translate=(600, 300)) *
- PolarTransform() *
- STTransform(scale=(np.pi/200, 0.005),
- translate=(-3*np.pi/4., 0.1)))
-
- for img in self.images:
- img.tr_sys = TransformSystem(self)
- img.tr_sys.visual_to_document = img.transform
-
- self.show()
-
- def on_draw(self, ev):
- gloo.clear(color='black', depth=True)
- gloo.set_viewport(0, 0, *self.physical_size)
- # Create a TransformSystem that will tell the visual how to draw
- for img in self.images:
- img.draw(img.tr_sys)
-
-
-# A simple custom Transform
-class SineTransform(BaseTransform):
- """
- Add sine wave to y-value for wavy effect.
- """
- glsl_map = """
- vec4 sineTransform(vec4 pos) {
- return vec4(pos.x, pos.y + sin(pos.x), pos.z, 1);
- }"""
-
- glsl_imap = """
- vec4 sineTransform(vec4 pos) {
- return vec4(pos.x, pos.y - sin(pos.x), pos.z, 1);
- }"""
-
- Linear = False
-
- @arg_to_array
- def map(self, coords):
- ret = coords.copy()
- ret[..., 1] += np.sin(ret[..., 0])
- return ret
-
- @arg_to_array
- def imap(self, coords):
- ret = coords.copy()
- ret[..., 1] -= np.sin(ret[..., 0])
- return ret
-
- def inverse(self):
- return InvSineTransform()
-
-
-class InvSineTransform(BaseTransform):
- glsl_map = SineTransform.glsl_imap
- glsl_imap = SineTransform.glsl_map
-
- Linear = False
-
- map = SineTransform.imap
- imap = SineTransform.map
-
- def inverse(self):
- return SineTransform()
-
-if __name__ == '__main__':
- win = Canvas()
- import sys
- if sys.flags.interactive != 1:
- vispy.app.run()
diff --git a/examples/basics/visuals/image_visual.py b/examples/basics/visuals/image_visual.py
deleted file mode 100644
index 3b21cfb..0000000
--- a/examples/basics/visuals/image_visual.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Simple demonstration of ImageVisual.
-"""
-
-import numpy as np
-import vispy.app
-from vispy import gloo
-from vispy import visuals
-from vispy.visuals.transforms import STTransform, TransformSystem
-
-image = np.random.normal(size=(100, 100, 3), loc=128,
- scale=50).astype(np.ubyte)
-
-
-class Canvas(vispy.app.Canvas):
- def __init__(self):
- vispy.app.Canvas.__init__(self, keys='interactive', size=(800, 800))
-
- self.image = visuals.ImageVisual(image, method='subdivide')
- self.image_transform = STTransform(scale=(7, 7), translate=(50, 50))
-
- # Create a TransformSystem that will tell the visual how to draw
- self.tr_sys = TransformSystem(self)
- self.tr_sys.visual_to_document = self.image_transform
-
- self.show()
-
- def on_draw(self, ev):
- gloo.clear(color='black', depth=True)
- gloo.set_viewport(0, 0, *self.physical_size)
- self.image.draw(self.tr_sys)
-
-
-if __name__ == '__main__':
- win = Canvas()
- import sys
- if sys.flags.interactive != 1:
- vispy.app.run()
diff --git a/examples/basics/visuals/line.py b/examples/basics/visuals/line.py
deleted file mode 100644
index cda3c86..0000000
--- a/examples/basics/visuals/line.py
+++ /dev/null
@@ -1,108 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Demonstration of various features of Line visual.
-"""
-import sys
-import numpy as np
-
-from vispy import app, gloo, visuals
-from vispy.visuals.transforms import STTransform, NullTransform
-
-# vertex positions of data to draw
-N = 200
-pos = np.zeros((N, 2), dtype=np.float32)
-pos[:, 0] = np.linspace(10, 390, N)
-pos[:, 1] = np.random.normal(size=N, scale=20, loc=0)
-
-# color array
-color = np.ones((N, 4), dtype=np.float32)
-color[:, 0] = np.linspace(0, 1, N)
-color[:, 1] = color[::-1, 0]
-
-# connection array
-connect = np.empty((N-1, 2), np.int32)
-connect[:, 0] = np.arange(N-1)
-connect[:, 1] = connect[:, 0] + 1
-connect[N/2, 1] = N/2 # put a break in the middle
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive',
- size=(800, 800))
- # Create several visuals demonstrating different features of Line
- self.lines = [
- # agg-method lines:
- # per-vertex color
- visuals.LineVisual(pos=pos, color=color, method='agg'),
- # solid
- visuals.LineVisual(pos=pos, color=(0, 0.5, 0.3, 1), method='agg'),
- # wide
- visuals.LineVisual(pos=pos, color=color, width=5, method='agg'),
-
- # GL-method lines:
- visuals.LineVisual(pos=pos, color=color, method='gl'),
- visuals.LineVisual(pos=pos, color=(0, 0.5, 0.3, 1), method='gl'),
- visuals.LineVisual(pos=pos, color=color, width=5, method='gl'),
- # GL-method: "connect" not available in AGG method yet
-
- # only connect alternate vert pairs
- visuals.LineVisual(pos=pos, color=(0, 0.5, 0.3, 1),
- connect='segments', method='gl'),
- # connect specific pairs
- visuals.LineVisual(pos=pos, color=(0, 0.5, 0.3, 1),
- connect=connect, method='gl'),
- ]
- counts = [0, 0]
- for i, line in enumerate(self.lines):
- # arrange lines in a grid
- tidx = (line.method == 'agg')
- x = 400 * tidx
- y = 140 * (counts[tidx] + 1)
- counts[tidx] += 1
- line.transform = STTransform(translate=[x, y])
- # redraw the canvas if any visuals request an update
- line.events.update.connect(lambda evt: self.update())
-
- self.texts = [visuals.TextVisual('GL', bold=True, font_size=24,
- color='w', pos=(200, 40)),
- visuals.TextVisual('Agg', bold=True, font_size=24,
- color='w', pos=(600, 40))]
- for text in self.texts:
- text.transform = NullTransform()
- self.visuals = self.lines + self.texts
-
- # create a TransformSystem for each visual.
- # (these are stored as attributes of each visual for convenience)
- for visual in self.visuals:
- visual.tr_sys = visuals.transforms.TransformSystem(self)
- visual.tr_sys.visual_to_document = visual.transform
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear('black')
- gloo.set_viewport(0, 0, *self.physical_size)
- for visual in self.visuals:
- visual.draw(visual.tr_sys)
-
-
-if __name__ == '__main__':
- win = Canvas()
-
- def update(ev):
- pos[:, 1] = np.random.normal(size=N, scale=30, loc=0)
- win.lines[0].set_data(pos)
- win.lines[3].set_data(pos)
-
- timer = app.Timer()
- timer.connect(update)
- timer.start(0)
-
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/basics/visuals/line_plot.py b/examples/basics/visuals/line_plot.py
deleted file mode 100644
index 05f6369..0000000
--- a/examples/basics/visuals/line_plot.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip (KNOWNFAIL)
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Simple demonstration of LinePlot visual.
-"""
-
-import numpy as np
-import sys
-
-from vispy import gloo, app, visuals
-
-# vertex positions of data to draw
-N = 20
-pos = np.zeros((N, 2), dtype=np.float32)
-pos[:, 0] = np.linspace(10, 790, N)
-pos[:, 1] = np.random.normal(size=N, scale=100, loc=400)
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive',
- size=(800, 800))
-
- self.line = visuals.LinePlotVisual(pos, color='w', edge_color='w',
- face_color=(0.2, 0.2, 1))
-
- self.tr_sys = visuals.transforms.TransformSystem(self)
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear('black')
- gloo.set_viewport(0, 0, *self.physical_size)
- self.line.draw(self.tr_sys)
-
-
-if __name__ == '__main__':
- win = Canvas()
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/basics/visuals/line_transform.py b/examples/basics/visuals/line_transform.py
deleted file mode 100644
index a80daf2..0000000
--- a/examples/basics/visuals/line_transform.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 1
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Demonstration of Line visual with arbitrary transforms.
-
-Several Line visuals are displayed that all have the same vertex position
-information, but different transformations.
-"""
-
-import numpy as np
-from vispy import app, gloo, visuals
-from vispy.visuals.transforms import (STTransform, LogTransform,
- AffineTransform, PolarTransform)
-import vispy.util
-vispy.util.use_log_level('debug')
-
-# vertex positions of data to draw
-N = 200
-pos = np.zeros((N, 2), dtype=np.float32)
-pos[:, 0] = np.linspace(-350, 350, N)
-pos[:, 1] = np.random.normal(size=N, scale=50, loc=0)
-
-# One array of colors
-color = np.ones((N, 4), dtype=np.float32)
-color[:, 0] = np.linspace(0, 1, N)
-color[:, 1] = color[::-1, 0]
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 800))
-
- # Define several Line visuals that use the same position data
- # but have different colors and transformations
- colors = [color, (1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 1, 1),
- (1, 1, 0, 1), (1, 1, 1, 1)]
-
- self.lines = [visuals.LineVisual(pos=pos, color=colors[i])
- for i in range(6)]
-
- center = STTransform(translate=(400, 400))
-
- self.lines[0].transform = center
-
- self.lines[1].transform = (center *
- STTransform(scale=(1, 0.1, 1)))
-
- self.lines[2].transform = (center *
- STTransform(translate=(200, 200, 0)) *
- STTransform(scale=(0.3, 0.5, 1)))
-
- self.lines[3].transform = (center *
- STTransform(translate=(-200, -200, 0),
- scale=(200, 1)) *
- LogTransform(base=(10, 0, 0)) *
- STTransform(translate=(1, 0, 0)))
-
- self.lines[4].transform = AffineTransform()
- self.lines[4].transform.rotate(45, (0, 0, 1))
- self.lines[4].transform.scale((0.3, 0.3, 1))
- self.lines[4].transform.translate((200, 200, 0))
-
- self.lines[5].transform = (STTransform(translate=(200, 600, 0),
- scale=(5, 5)) *
- PolarTransform() *
- LogTransform(base=(2, 0, 0)) *
- STTransform(scale=(0.01, 0.1),
- translate=(4, 20)))
-
- for line in self.lines:
- tr_sys = visuals.transforms.TransformSystem(self)
- tr_sys.visual_to_document = line.transform
- line.tr_sys = tr_sys
-
- self.show()
-
- def on_draw(self, ev):
- gloo.clear('black', depth=True)
- gloo.set_viewport(0, 0, *self.physical_size)
- for line in self.lines:
- line.draw(line.tr_sys)
-
-if __name__ == '__main__':
- win = Canvas()
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/basics/visuals/markers.py b/examples/basics/visuals/markers.py
deleted file mode 100644
index 99b24fc..0000000
--- a/examples/basics/visuals/markers.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-""" Display markers at different sizes and line thicknessess.
-"""
-
-import numpy as np
-
-from vispy import app, gloo, visuals
-from vispy.visuals.transforms import STTransform, TransformSystem
-
-n = 500
-pos = np.zeros((n, 2))
-colors = np.ones((n, 4), dtype=np.float32)
-radius, theta, dtheta = 1.0, 0.0, 5.5 / 180.0 * np.pi
-for i in range(500):
- theta += dtheta
- x = 256 + radius * np.cos(theta)
- y = 256 + radius * np.sin(theta)
- r = 10.1 - i * 0.02
- radius -= 0.45
- pos[i] = x, y
- colors[i] = (i/500, 1.0-i/500, 0, 1)
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(512, 512),
- title="Marker demo [press space to change marker]")
- self.index = 0
- self.scale = 1.
- self.tr_sys = TransformSystem(self)
- self.tr_sys.visual_to_document = STTransform()
- self.markers = visuals.MarkersVisual()
- self.markers.set_data(pos, face_color=colors)
- self.markers.set_symbol(visuals.marker_types[self.index])
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear(color='white')
- self.markers.draw(self.tr_sys)
-
- def on_mouse_wheel(self, event):
- """Use the mouse wheel to zoom."""
- self.scale *= 1.25 if event.delta[1] > 0 else 0.8
- self.scale = max(min(self.scale, 1e2), 1e-2)
- self.apply_zoom()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def apply_zoom(self):
- gloo.set_viewport(0, 0, *self.physical_size)
- self.tr_sys.visual_to_document.scale = (self.scale, self.scale)
- self.update()
-
- def on_key_press(self, event):
- if event.text == ' ':
- self.index = (self.index + 1) % (len(visuals.marker_types))
- self.markers.set_symbol(visuals.marker_types[self.index])
- self.update()
-
-if __name__ == '__main__':
- canvas = Canvas()
- app.run()
diff --git a/examples/basics/visuals/mesh.py b/examples/basics/visuals/mesh.py
deleted file mode 100644
index 0939337..0000000
--- a/examples/basics/visuals/mesh.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Simple demonstration of Mesh visual.
-"""
-
-import numpy as np
-from vispy import app, gloo, visuals
-from vispy.geometry import create_sphere
-from vispy.visuals.transforms import (STTransform, AffineTransform,
- ChainTransform)
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 550))
-
- self.meshes = []
- self.rotation = AffineTransform()
-
- # Generate some data to work with
- global mdata
- mdata = create_sphere(20, 40, 1.0)
-
- # Mesh with pre-indexed vertices, uniform color
- self.meshes.append(visuals.MeshVisual(meshdata=mdata, color='r'))
-
- ## Mesh with pre-indexed vertices, per-face color
- ## Because vertices are pre-indexed, we get a different color
- ## every time a vertex is visited, resulting in sharp color
- ## differences between edges.
- verts = mdata.get_vertices(indexed='faces')
- nf = verts.size//9
- fcolor = np.ones((nf, 3, 4), dtype=np.float32)
- fcolor[..., 0] = np.linspace(1, 0, nf)[:, np.newaxis]
- fcolor[..., 1] = np.random.normal(size=nf)[:, np.newaxis]
- fcolor[..., 2] = np.linspace(0, 1, nf)[:, np.newaxis]
- mesh = visuals.MeshVisual(vertices=verts, face_colors=fcolor)
- self.meshes.append(mesh)
-
- ## Mesh with unindexed vertices, per-vertex color
- ## Because vertices are unindexed, we get the same color
- ## every time a vertex is visited, resulting in no color differences
- ## between edges.
- verts = mdata.get_vertices()
- faces = mdata.get_faces()
- nv = verts.size//3
- vcolor = np.ones((nv, 4), dtype=np.float32)
- vcolor[:, 0] = np.linspace(1, 0, nv)
- vcolor[:, 1] = np.random.normal(size=nv)
- vcolor[:, 2] = np.linspace(0, 1, nv)
- self.meshes.append(visuals.MeshVisual(verts, faces, vcolor))
- self.meshes.append(visuals.MeshVisual(verts, faces, vcolor,
- shading='flat'))
- self.meshes.append(visuals.MeshVisual(verts, faces, vcolor,
- shading='smooth'))
-
- # Lay out meshes in a grid
- grid = (3, 3)
- s = 300. / max(grid)
- for i, mesh in enumerate(self.meshes):
- x = 800. * (i % grid[0]) / grid[0] + 400. / grid[0] - 2
- y = 800. * (i // grid[1]) / grid[1] + 400. / grid[1] + 2
- transform = ChainTransform([STTransform(translate=(x, y),
- scale=(s, s, 1)),
- self.rotation])
- tr_sys = visuals.transforms.TransformSystem(self)
- tr_sys.visual_to_document = transform
- mesh.tr_sys = tr_sys
-
- self.show()
-
- self.timer = app.Timer(connect=self.rotate)
- self.timer.start(0.016)
-
- def rotate(self, event):
- self.rotation.rotate(1, (0, 1, 0))
- self.update()
-
- def on_draw(self, ev):
- gloo.set_viewport(0, 0, *self.physical_size)
- gloo.clear(color='black', depth=True)
- for mesh in self.meshes:
- mesh.draw(mesh.tr_sys)
-
-
-if __name__ == '__main__':
- win = Canvas()
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/basics/visuals/polygon_visual.py b/examples/basics/visuals/polygon_visual.py
deleted file mode 100644
index 135eea3..0000000
--- a/examples/basics/visuals/polygon_visual.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Demonstration of Polygon and subclasses
-"""
-
-import sys
-import numpy as np
-
-from vispy import app, gloo, visuals
-from vispy.visuals import transforms
-
-# vertex positions of polygon data to draw
-pos = np.array([[0, 0, 0],
- [0.25, 0.22, 0],
- [0.25, 0.5, 0],
- [0, 0.5, 0],
- [-0.25, 0.25, 0]])
-
-pos = np.array([[0, 0],
- [10, 0],
- [10, 10],
- [20, 10],
- [20, 20],
- [25, 20],
- [25, 25],
- [20, 25],
- [20, 20],
- [10, 17],
- [5, 25],
- [9, 30],
- [6, 15],
- [15, 12.5],
- [0, 5]])
-
-theta = np.linspace(0, 2*np.pi, 11)
-pos = np.hstack([np.cos(theta)[:, np.newaxis],
- np.sin(theta)[:, np.newaxis]])
-pos[::2] *= 0.4
-pos[-1] = pos[0]
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 800))
- global pos
- self.visuals = []
- polygon = visuals.PolygonVisual(pos=pos, color=(0.8, .2, 0, 1),
- border_color=(1, 1, 1, 1))
- polygon.transform = transforms.STTransform(scale=(200, 200),
- translate=(600, 600))
- self.visuals.append(polygon)
-
- ellipse = visuals.EllipseVisual(pos=(0, 0, 0), radius=(100, 150),
- color=(0.2, 0.2, 0.8, 1),
- border_color=(1, 1, 1, 1),
- start_angle=180., span_angle=150.)
- ellipse.transform = transforms.STTransform(scale=(0.9, 1.5),
- translate=(200, 300))
- self.visuals.append(ellipse)
-
- rect = visuals.RectangleVisual(pos=(600, 200, 0), height=200.,
- width=300.,
- radius=[30., 30., 0., 0.],
- color=(0.5, 0.5, 0.2, 1),
- border_color='white')
- rect.transform = transforms.NullTransform()
- self.visuals.append(rect)
-
- rpolygon = visuals.RegularPolygonVisual(pos=(200., 600., 0),
- radius=160,
- color=(0.2, 0.8, 0.2, 1),
- border_color=(1, 1, 1, 1),
- sides=6)
- rpolygon.transform = transforms.NullTransform()
- self.visuals.append(rpolygon)
-
- for v in self.visuals:
- v.tr_sys = transforms.TransformSystem(self)
- v.tr_sys.visual_to_document = v.transform
-
- self.show()
-
- def on_draw(self, ev):
- gloo.set_clear_color((0, 0, 0, 1))
- gloo.set_viewport(0, 0, *self.physical_size)
- gloo.clear()
- for vis in self.visuals:
- vis.draw(vis.tr_sys)
-
-
-if __name__ == '__main__':
- win = Canvas()
- if sys.flags.interactive != 1:
- win.app.run()
diff --git a/examples/basics/visuals/rescalingmarkers.py b/examples/basics/visuals/rescalingmarkers.py
deleted file mode 100644
index 16983c1..0000000
--- a/examples/basics/visuals/rescalingmarkers.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-""" Display markers at different sizes and line thicknessess.
-"""
-
-import numpy as np
-import vispy.scene as scene
-from vispy.scene import visuals
-import vispy.visuals as impl_visuals
-from vispy import app
-
-n = 500
-pos = np.zeros((n, 2))
-colors = np.ones((n, 4), dtype=np.float32)
-radius, theta, dtheta = 1.0, 0.0, 5.5 / 180.0 * np.pi
-for i in range(500):
- theta += dtheta
- x = radius * np.cos(theta)
- y = radius * np.sin(theta)
- r = 10.1 - i * 0.02
- radius -= 0.45
- pos[i] = x/512.+.5, 1.-(y/512.+.5)
-pos *= 512
-
-
-class Canvas(scene.SceneCanvas):
-
- def __init__(self):
- scene.SceneCanvas.__init__(
- self,
- keys='interactive', size=(512, 512),
- title="Marker demo [press space to change marker]",
- bgcolor='white'
- )
- self.index = 0
- self.markers = visuals.Markers()
- self.markers.set_data(pos, face_color=(0, 1, 0), scaling=False)
- self.markers.set_symbol(impl_visuals.marker_types[self.index])
- self.text = visuals.Text(impl_visuals.marker_types[self.index],
- pos=(80, 15), font_size=14,
- color='black', parent=self.scene)
-
- def on_key_press(self, event):
- if event.text == ' ':
- self.index = (self.index + 1) % (len(impl_visuals.marker_types))
- self.markers.set_symbol(impl_visuals.marker_types[self.index])
- self.text.text = impl_visuals.marker_types[self.index]
- self.update()
-
-
-canvas = Canvas()
-grid = canvas.central_widget.add_grid()
-vb1 = grid.add_view(row=0, col=0)
-vb1.add(canvas.markers)
-
-if __name__ == '__main__':
- canvas.show()
- app.run()
diff --git a/examples/basics/visuals/text_visual.py b/examples/basics/visuals/text_visual.py
deleted file mode 100644
index bacb085..0000000
--- a/examples/basics/visuals/text_visual.py
+++ /dev/null
@@ -1,42 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-
-from vispy import app, gloo, visuals
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, title='Glyphs', keys='interactive')
- self.font_size = 48.
- self.text = visuals.TextVisual('', bold=True)
- self.tr_sys = visuals.transforms.TransformSystem(self)
- self.apply_zoom()
-
- def on_draw(self, event):
- gloo.clear(color='white')
- gloo.set_viewport(0, 0, *self.physical_size)
- self.text.draw(self.tr_sys)
-
- def on_mouse_wheel(self, event):
- """Use the mouse wheel to zoom."""
- self.font_size *= 1.25 if event.delta[1] > 0 else 0.8
- self.font_size = max(min(self.font_size, 160.), 6.)
- self.apply_zoom()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def apply_zoom(self):
- self.text.text = '%s pt' % round(self.font_size, 1)
- self.text.font_size = self.font_size
- self.text.pos = self.size[0] // 2, self.size[1] // 2
- self.update()
-
-if __name__ == '__main__':
- c = Canvas()
- c.show()
- c.app.run()
diff --git a/examples/basics/visuals/tube.py b/examples/basics/visuals/tube.py
deleted file mode 100644
index c1301f1..0000000
--- a/examples/basics/visuals/tube.py
+++ /dev/null
@@ -1,70 +0,0 @@
-"""
-Demonstration of Tube
-"""
-
-import sys
-from vispy import scene
-from vispy.geometry.torusknot import TorusKnot
-
-from colorsys import hsv_to_rgb
-import numpy as np
-
-canvas = scene.SceneCanvas(keys='interactive')
-canvas.view = canvas.central_widget.add_view()
-
-points1 = TorusKnot(5, 3).first_component[:-1]
-points1[:, 0] -= 20.
-points1[:, 2] -= 15.
-
-points2 = points1.copy()
-points2[:, 2] += 30.
-
-points3 = points1.copy()
-points3[:, 0] += 41.
-points3[:, 2] += 30
-
-points4 = points1.copy()
-points4[:, 0] += 41.
-
-colors = np.linspace(0, 1, len(points1))
-colors = np.array([hsv_to_rgb(c, 1, 1) for c in colors])
-
-vertex_colors = np.random.random(8 * len(points1))
-vertex_colors = np.array([hsv_to_rgb(c, 1, 1) for c in vertex_colors])
-
-l1 = scene.visuals.Tube(points1,
- shading='flat',
- color=colors, # this is overridden by
- # the vertex_colors argument
- vertex_colors=vertex_colors,
- tube_points=8)
-
-l2 = scene.visuals.Tube(points2,
- color=['red', 'green', 'blue'],
- shading='smooth',
- tube_points=8)
-
-l3 = scene.visuals.Tube(points3,
- color=colors,
- shading='flat',
- tube_points=8,
- closed=True)
-
-l4 = scene.visuals.Tube(points4,
- color=colors,
- shading='flat',
- tube_points=8,
- mode='lines')
-
-canvas.view.add(l1)
-canvas.view.add(l2)
-canvas.view.add(l3)
-canvas.view.add(l4)
-canvas.view.camera = scene.TurntableCamera()
-# tube does not expose its limits yet
-canvas.view.camera.set_range((-20, 20), (-20, 20), (-20, 20))
-canvas.show()
-
-if __name__ == '__main__':
- if sys.flags.interactive != 1:
- canvas.app.run()
diff --git a/examples/basics/visuals/visual_filters.py b/examples/basics/visuals/visual_filters.py
deleted file mode 100644
index 8db1382..0000000
--- a/examples/basics/visuals/visual_filters.py
+++ /dev/null
@@ -1,108 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 1
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Demonstration of Line visual with arbitrary transforms.
-
-Several Line visuals are displayed that all have the same vertex position
-information, but different transformations.
-"""
-
-import numpy as np
-from vispy import app, gloo, visuals
-from vispy.visuals.transforms import STTransform
-from vispy.visuals.components import Clipper, Alpha, ColorFilter
-from vispy.visuals.shaders import Function
-from vispy.geometry import Rect
-
-# vertex positions of data to draw
-N = 400
-pos = np.zeros((N, 2), dtype=np.float32)
-pos[:, 0] = np.linspace(0, 350, N)
-pos[:, 1] = np.random.normal(size=N, scale=20, loc=0)
-
-
-class Canvas(app.Canvas):
- def __init__(self):
-
- # Define several Line visuals that use the same position data
- self.lines = [visuals.LineVisual(pos=pos)
- for i in range(6)]
-
- self.lines[0].transform = STTransform(translate=(0, 50))
-
- # Clipping filter (requires update when window is resized)
- self.lines[1].transform = STTransform(translate=(400, 50))
- self.clipper = Clipper([500, 725, 200, 50])
- self.lines[1].attach(self.clipper)
-
- # Opacity filter
- self.lines[2].transform = STTransform(translate=(0, 150))
- self.lines[2].attach(Alpha(0.4))
-
- # Color filter (for anaglyph stereo)
- self.lines[3].transform = STTransform(translate=(400, 150))
- self.lines[3].attach(ColorFilter([1, 0, 0, 1]))
-
- # A custom filter
- class Hatching(object):
- def __init__(self):
- self.shader = Function("""
- void screen_filter() {
- float f = gl_FragCoord.x * 0.4 + gl_FragCoord.y;
- f = mod(f, 20);
-
- if( f < 5.0 ) {
- discard;
- }
-
- if( f < 20.0 ) {
- gl_FragColor.g = gl_FragColor.g + 0.05 * (20-f);
- }
- }
- """)
-
- def _attach(self, visual):
- visual._get_hook('frag', 'post').add(self.shader())
-
- self.lines[4].transform = STTransform(translate=(0, 250))
- self.lines[4].attach(Hatching())
-
- # Mixing filters
- self.lines[5].transform = STTransform(translate=(400, 250))
- self.lines[5].attach(ColorFilter([1, 0, 0, 1]))
- self.lines[5].attach(Hatching())
-
- app.Canvas.__init__(self, keys='interactive', size=(800, 800))
-
- for line in self.lines:
- tr_sys = visuals.transforms.TransformSystem(self)
- tr_sys.visual_to_document = line.transform
- line.tr_sys = tr_sys
-
- self.show(True)
-
- def on_draw(self, ev):
- gloo.clear('black', depth=True)
- gloo.set_viewport(0, 0, *self.physical_size)
- for line in self.lines:
- line.draw(line.tr_sys)
-
- def on_resize(self, event):
- for line in self.lines:
- # let the transform systems know that the window has resized
- line.tr_sys.auto_configure()
-
- # Need to update clipping boundaries if the window resizes.
- trs = self.lines[1].tr_sys
- tr = trs.document_to_framebuffer * trs.visual_to_document
- self.clipper.bounds = tr.map(Rect(50, -15, 250, 30))
-
-
-if __name__ == '__main__':
- win = Canvas()
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/benchmark/scene_test_1.py b/examples/benchmark/scene_test_1.py
deleted file mode 100644
index 3aa6009..0000000
--- a/examples/benchmark/scene_test_1.py
+++ /dev/null
@@ -1,355 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Compare an optimal pan/zoom implementation to the same functionality
-provided by scenegraph.
-
-Use --vispy-cprofile to see an overview of time spent in all functions.
-Use util.profiler and --vispy-profile=ClassName.method_name for more directed
-profiling measurements.
-"""
-import numpy as np
-import math
-
-from vispy import gloo, app, scene
-from vispy.visuals import Visual
-from vispy.visuals.shaders import ModularProgram, Function, Variable
-from vispy.visuals.transforms import TransformSystem, BaseTransform
-from vispy.util.profiler import Profiler
-
-
-class PanZoomTransform(BaseTransform):
- glsl_map = """
- vec4 pz_transform_map(vec2 pos) {
- return vec4($zoom * (pos + $pan), 0, 1);
- }
- """
-
- glsl_imap = """
- vec4 pz_transform_imap(vec2 pos) {
- return vec4(pos / $zoom - $pan, 0, 1);
- }
- """
-
- Linear = True
- Orthogonal = True
- NonScaling = False
- Isometric = False
-
- def __init__(self):
- super(PanZoomTransform, self).__init__()
- self._pan = None
- self._zoom = None
-
- @property
- def pan(self):
- if isinstance(self._pan, Variable):
- return np.array(self._pan.value, dtype=np.float32)
- else:
- raise NotImplementedError()
-
- @pan.setter
- def pan(self, value):
- if isinstance(value, Variable):
- self._pan = value
- self._shader_map['pan'] = self._pan
- elif isinstance(self._pan, Variable):
- self._pan.value = value
- else:
- raise NotImplementedError()
-
- @property
- def zoom(self):
- if isinstance(self._zoom, Variable):
- return np.array(self._zoom.value, dtype=np.float32)
- else:
- raise NotImplementedError()
-
- @zoom.setter
- def zoom(self, value):
- if isinstance(value, Variable):
- self._zoom = value
- self._shader_map['zoom'] = self._zoom
- elif isinstance(self._zoom, Variable):
- self._zoom.value = value
- else:
- raise NotImplementedError()
-
- def map(self, coords):
- if not isinstance(coords, np.ndarray):
- coords = np.array(coords)
- return self.zoom[None, :] * (coords + self.pan[None, :])
-
- def imap(self, coords):
- if not isinstance(coords, np.ndarray):
- coords = np.array(coords)
- return (coords / self.zoom[None, :]) - self.pan[None, :]
-
-
-class PanZoomCanvas(app.Canvas):
- def __init__(self, **kwargs):
- super(PanZoomCanvas, self).__init__(keys='interactive', **kwargs)
- self._visuals = []
-
- self._pz = PanZoomTransform()
- self._pz.pan = Variable('uniform vec2 u_pan', (0, 0))
- self._pz.zoom = Variable('uniform vec2 u_zoom', (1, 1))
-
- self.width, self.height = self.size
- gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])
- gloo.set_state(clear_color='black', blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- self._tr = TransformSystem(self)
- self.show()
-
- def on_resize(self, event):
- self.width, self.height = event.size
- gloo.set_viewport(0, 0, event.physical_size[0], event.physical_size[1])
-
- def _normalize(self, x_y):
- x, y = x_y
- w, h = float(self.width), float(self.height)
- return x/(w/2.)-1., y/(h/2.)-1.
-
- def bounds(self):
- pan_x, pan_y = self._pz.pan
- zoom_x, zoom_y = self._pz.zoom
- xmin = -1 / zoom_x - pan_x
- xmax = +1 / zoom_x - pan_x
- ymin = -1 / zoom_y - pan_y
- ymax = +1 / zoom_y - pan_y
- return (xmin, ymin, xmax, ymax)
-
- def on_mouse_move(self, event):
- if event.is_dragging and not event.modifiers:
- x0, y0 = self._normalize(event.press_event.pos)
- x1, y1 = self._normalize(event.last_event.pos)
- x, y = self._normalize(event.pos)
- dx, dy = x - x1, -(y - y1)
- button = event.press_event.button
-
- pan_x, pan_y = self._pz.pan
- zoom_x, zoom_y = self._pz.zoom
-
- if button == 1:
- self._pz.pan = (pan_x + dx/zoom_x,
- pan_y + dy/zoom_y)
- elif button == 2:
- zoom_x_new, zoom_y_new = (zoom_x * math.exp(2.5 * dx),
- zoom_y * math.exp(2.5 * dy))
- self._pz.zoom = (zoom_x_new, zoom_y_new)
- self._pz.pan = (pan_x - x0 * (1./zoom_x - 1./zoom_x_new),
- pan_y + y0 * (1./zoom_y - 1./zoom_y_new))
- self.update()
-
- def on_mouse_wheel(self, event):
- prof = Profiler() # noqa
- if not event.modifiers:
- dx = np.sign(event.delta[1])*.05
- x0, y0 = self._normalize(event.pos)
- pan_x, pan_y = self._pz.pan
- zoom_x, zoom_y = self._pz.zoom
- zoom_x_new, zoom_y_new = (zoom_x * math.exp(2.5 * dx),
- zoom_y * math.exp(2.5 * dx))
- self._pz.zoom = (zoom_x_new, zoom_y_new)
- self._pz.pan = (pan_x - x0 * (1./zoom_x - 1./zoom_x_new),
- pan_y + y0 * (1./zoom_y - 1./zoom_y_new))
- self.update()
-
- def on_key_press(self, event):
- if event.key == 'R':
- self._pz.zoom = (1., 1.)
- self._pz.pan = (0., 0.)
- self.update()
-
- def add_visual(self, name, value):
- value._program.vert['transform'] = self._pz
- value.events.update.connect(self.update)
- self._visuals.append(value)
-
- def __setattr__(self, name, value):
- if isinstance(value, Visual):
- self.add_visual(name, value)
- super(PanZoomCanvas, self).__setattr__(name, value)
-
- @property
- def visuals(self):
- return self._visuals
-
- def on_draw(self, event):
- prof = Profiler()
- gloo.clear()
- for visual in self.visuals:
- visual.draw(self._tr)
- prof('draw visual')
-
-
-X_TRANSFORM = """
-float get_x(float x_index) {
- // 'x_index' is between 0 and nsamples.
- return -1. + 2. * x_index / (float($nsamples) - 1.);
-}
-"""
-
-Y_TRANSFORM = """
-float get_y(float y_index, float sample) {
- // 'y_index' is between 0 and nsignals.
- float a = float($scale) / float($nsignals);
- float b = -1. + 2. * (y_index + .5) / float($nsignals);
-
- return a * sample + b;
-}
-"""
-
-DISCRETE_CMAP = """
-vec3 get_color(float index) {
- float x = (index + .5) / float($ncolors);
- return texture2D($colormap, vec2(x, .5)).rgb;
-}
-"""
-
-
-class SignalsVisual(Visual):
- VERTEX_SHADER = """
- attribute float a_position;
-
- attribute vec2 a_index;
- varying vec2 v_index;
-
- uniform float u_nsignals;
- uniform float u_nsamples;
-
- void main() {
- vec2 position = vec2($get_x(a_index.y),
- $get_y(a_index.x, a_position));
- gl_Position = $transform(position);
-
- v_index = a_index;
- }
- """
-
- FRAGMENT_SHADER = """
- varying vec2 v_index;
-
- void main() {
- gl_FragColor = vec4($get_color(v_index.x), 1.);
-
- // Discard vertices between two signals.
- if ((fract(v_index.x) > 0.))
- discard;
- }
- """
-
- def __init__(self, data):
- super(SignalsVisual, self).__init__()
-
- self._program = ModularProgram(self.VERTEX_SHADER,
- self.FRAGMENT_SHADER)
-
- nsignals, nsamples = data.shape
- # nsamples, nsignals = data.shape
-
- self._data = data
-
- a_index = np.c_[np.repeat(np.arange(nsignals), nsamples),
- np.tile(np.arange(nsamples), nsignals)
- ].astype(np.float32)
-
- # Doesn't seem to work nor to be very efficient.
- # indices = nsignals * np.arange(nsamples)
- # indices = indices[None, :] + np.arange(nsignals)[:, None]
- # indices = indices.flatten().astype(np.uint32)
- # self._ibuffer = gloo.IndexBuffer(indices)
-
- self._buffer = gloo.VertexBuffer(data.reshape(-1, 1))
- self._program['a_position'] = self._buffer
- self._program['a_index'] = a_index
-
- x_transform = Function(X_TRANSFORM)
- x_transform['nsamples'] = nsamples
- self._program.vert['get_x'] = x_transform
-
- y_transform = Function(Y_TRANSFORM)
- y_transform['scale'] = Variable('uniform float u_signal_scale', 5.)
- y_transform['nsignals'] = nsignals
- self._program.vert['get_y'] = y_transform
- self._y_transform = y_transform
-
- colormap = Function(DISCRETE_CMAP)
- cmap = np.random.uniform(size=(1, nsignals, 3),
- low=.5, high=.9).astype(np.float32)
- tex = gloo.Texture2D((cmap * 255).astype(np.uint8))
- colormap['colormap'] = Variable('uniform sampler2D u_colormap', tex)
- colormap['ncolors'] = nsignals
- self._program.frag['get_color'] = colormap
-
- @property
- def data(self):
- return self._data
-
- @data.setter
- def data(self, value):
- self._data = value
- self._buffer.set_subdata(value.reshape(-1, 1))
- self.update()
-
- @property
- def signal_scale(self):
- return self._y_transform['scale'].value
-
- @signal_scale.setter
- def signal_scale(self, value):
- self._y_transform['scale'].value = value
- self.update()
-
- def draw(self, transform_system):
- self._program.draw('line_strip')
-
-
-class Signals(SignalsVisual, scene.visuals.Node):
- VERTEX_SHADER = """
- attribute float a_position;
-
- attribute vec2 a_index;
- varying vec2 v_index;
-
- uniform float u_nsignals;
- uniform float u_nsamples;
-
- void main() {
- vec4 position = vec4($get_x(a_index.y),
- $get_y(a_index.x, a_position), 0, 1);
- gl_Position = $transform(position);
-
- v_index = a_index;
- }
- """
-
- def draw(self, transform_system):
- self._program.vert['transform'] = transform_system.get_full_transform()
- self._program.draw('line_strip')
-
-
-if __name__ == '__main__':
- data = np.random.normal(size=(128, 1000)).astype(np.float32)
-
- pzcanvas = PanZoomCanvas(position=(400, 300), size=(800, 600),
- title="PanZoomCanvas")
- visual = SignalsVisual(data)
- pzcanvas.add_visual('signal', visual)
-
- scanvas = scene.SceneCanvas(show=True, keys='interactive',
- title="SceneCanvas")
- svisual = Signals(data)
- view = scanvas.central_widget.add_view()
- view.add(svisual)
- view.camera = 'panzoom'
-
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/benchmark/scene_test_2.py b/examples/benchmark/scene_test_2.py
deleted file mode 100644
index d64c814..0000000
--- a/examples/benchmark/scene_test_2.py
+++ /dev/null
@@ -1,193 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Compare an optimal plot grid implementation to the same functionality
-provided by scenegraph.
-
-Use --vispy-cprofile to see an overview of time spent in all functions.
-Use util.profiler and --vispy-profile=ClassName.method_name for more directed
-profiling measurements.
-"""
-from __future__ import division
-import numpy as np
-
-from vispy import gloo, app, scene, visuals
-from vispy.util.profiler import Profiler
-
-
-class GridCanvas(app.Canvas):
- def __init__(self, cells, **kwargs):
- m, n = (10, 10)
- self.grid_size = (m, n)
- self.cells = cells
- super(GridCanvas, self).__init__(keys='interactive',
- show=True, **kwargs)
-
- def on_initialize(self, event):
- gloo.set_state(clear_color='black', blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- def on_mouse_move(self, event):
- if event.is_dragging and not event.modifiers:
- dx = (event.pos - event.last_event.pos) * [1, -1]
- i, j = event.press_event.pos / self.size
- m, n = len(self.cells), len(self.cells[0])
- cell = self.cells[int(i*m)][n - 1 - int(j*n)]
- if event.press_event.button == 1:
- offset = (np.array(cell.offset) +
- (dx / (np.array(self.size) / [m, n])) *
- (2 / np.array(cell.scale)))
- cell.set_transform(offset, cell.scale)
-
- else:
- cell.set_transform(cell.offset, cell.scale * 1.05 ** dx)
- self.update()
-
- def on_draw(self, event):
- prof = Profiler() # noqa
- gloo.clear()
- M = len(self.cells)
- N = len(self.cells[0])
- w, h = self.size
- for i in range(M):
- for j in range(N):
- gloo.set_viewport(w*i/M, h*j/N, w/M, h/N)
- self.cells[i][j].draw()
-
-
-vert = """
-attribute vec2 pos;
-uniform vec2 offset;
-uniform vec2 scale;
-
-void main() {
- gl_Position = vec4((pos + offset) * scale, 0, 1);
-}
-"""
-
-frag = """
-void main() {
- gl_FragColor = vec4(1, 1, 1, 0.5);
-}
-"""
-
-
-class Line(object):
- def __init__(self, data, offset, scale):
- self.data = gloo.VertexBuffer(data)
- self.program = gloo.Program(vert, frag)
- self.program['pos'] = self.data
- self.set_transform(offset, scale)
-
- def set_transform(self, offset, scale):
- self.offset = offset
- self.scale = scale
- self.program['offset'] = self.offset
- self.program['scale'] = self.scale
-
- def draw(self):
- self.program.draw('line_strip')
-
-
-class VisualCanvas(app.Canvas):
- def __init__(self, vis, **kwargs):
- super(VisualCanvas, self).__init__(keys='interactive',
- show=True, **kwargs)
- m, n = (10, 10)
- self.grid_size = (m, n)
- self.visuals = vis
- for row in vis:
- for v in row:
- v.tr_sys = visuals.transforms.TransformSystem(self)
- v.tr_sys.visual_to_document = v.transform
-
- def on_initialize(self, event):
- gloo.set_state(clear_color='black', blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- def on_mouse_move(self, event):
- if event.is_dragging and not event.modifiers:
- dx = (event.pos - event.last_event.pos)
- x, y = event.press_event.pos / self.size
- m, n = self.grid_size
- i, j = int(x*m), n - 1 - int(y*n)
- v = self.visuals[i][j]
- tr = v.transform
- if event.press_event.button == 1:
- offset = np.array(tr.translate)[:2] + dx
- tr.translate = offset
-
- else:
- tr.scale = tr.scale[:2] * 1.05 ** (dx * (1, -1))
- self.update()
-
- def on_draw(self, event):
- prof = Profiler() # noqa
- gloo.clear()
- M, N = self.grid_size
- w, h = self.size
- for i in range(M):
- for j in range(N):
- gloo.set_viewport(w*i/M, h*j/N, w/M, h/N)
- v = self.visuals[i][j]
- v.draw(v.tr_sys)
-
-
-if __name__ == '__main__':
- M, N = (10, 10)
-
- data = np.empty((10000, 2), dtype=np.float32)
- data[:, 0] = np.linspace(0, 100, data.shape[0])
- data[:, 1] = np.random.normal(size=data.shape[0])
-
- # Optimized version
- cells = []
- for i in range(M):
- row = []
- cells.append(row)
- for j in range(N):
- row.append(Line(data, offset=(-50, 0), scale=(1.9/100, 2/10)))
-
- gcanvas = GridCanvas(cells, position=(400, 300), size=(800, 600),
- title="GridCanvas")
-
- # Visual version
- vlines = []
- for i in range(M):
- row = []
- vlines.append(row)
- for j in range(N):
- v = visuals.LineVisual(pos=data, color=(1, 1, 1, 0.5), method='gl')
- v.transform = visuals.transforms.STTransform(translate=(0, 200),
- scale=(7, 50))
- row.append(v)
-
- vcanvas = VisualCanvas(vlines, position=(400, 300), size=(800, 600),
- title="VisualCanvas")
-
- # Scenegraph version
- scanvas = scene.SceneCanvas(show=True, keys='interactive',
- title="SceneCanvas")
-
- scanvas.size = 800, 600
- scanvas.show()
- grid = scanvas.central_widget.add_grid()
-
- lines = []
- for i in range(10):
- lines.append([])
- for j in range(10):
- vb = grid.add_view(row=i, col=j)
- vb.camera.rect = (0, -5), (100, 10)
- vb.border = (1, 1, 1, 0.4)
- line = scene.visuals.Line(pos=data, color=(1, 1, 1, 0.5),
- method='gl')
- vb.add(line)
-
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/benchmark/simple_glut.py b/examples/benchmark/simple_glut.py
deleted file mode 100755
index 1ef06f9..0000000
--- a/examples/benchmark/simple_glut.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-from vispy.gloo import gl
-
-
-def on_display():
- gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
- glut.glutSwapBuffers()
-
-
-def on_keyboard(key, x, y):
- if key == '\033':
- sys.exit()
-
-
-def on_idle():
- global t, t0, frames
- t = glut.glutGet(glut.GLUT_ELAPSED_TIME)
- frames = frames + 1
- elapsed = (t - t0) / 1000.0
- if elapsed > 2.5:
- print("FPS : %.2f (%d frames in %.2f second)"
- % (frames / elapsed, frames, elapsed))
- t0, frames = t, 0
- glut.glutPostRedisplay()
-
-
-if __name__ == '__main__':
- import sys
- import OpenGL.GLUT as glut
-
- glut.glutInit(sys.argv)
- glut.glutInitDisplayMode(
- glut.GLUT_DOUBLE | glut.GLUT_RGB | glut.GLUT_DEPTH)
- glut.glutInitWindowSize(512, 512)
- glut.glutCreateWindow("Do nothing benchmark (GLUT)")
- glut.glutDisplayFunc(on_display)
- glut.glutKeyboardFunc(on_keyboard)
-
- t0, frames, t = glut.glutGet(glut.GLUT_ELAPSED_TIME), 0, 0
- glut.glutIdleFunc(on_idle)
- glut.glutMainLoop()
diff --git a/examples/benchmark/simple_vispy.py b/examples/benchmark/simple_vispy.py
deleted file mode 100755
index c2df288..0000000
--- a/examples/benchmark/simple_vispy.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-import sys
-
-from vispy import app
-from vispy.gloo import clear
-
-# app.use_app('pyqt4') # or pyside, glut, pyglet, sdl2, etc.
-
-canvas = app.Canvas(size=(512, 512), title="Do nothing benchmark (vispy)",
- keys='interactive')
-
-
- at canvas.connect
-def on_draw(event):
- clear(color=True, depth=True)
- canvas.update() # Draw frames as fast as possible
-
-if __name__ == '__main__':
- canvas.show()
- canvas.measure_fps()
- if sys.flags.interactive == 0:
- app.run()
diff --git a/examples/collections/choropleth.py b/examples/collections/choropleth.py
deleted file mode 100644
index 694ac67..0000000
--- a/examples/collections/choropleth.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: testskip
-
-import json
-
-import numpy as np
-
-from vispy import app, gloo
-from vispy.util import load_data_file
-from vispy.visuals.collections import PathCollection, PolygonCollection
-from vispy.visuals.transforms import PanZoomTransform
-
-
-path = load_data_file('uscounties/uscounties.geojson')
-with open(path, 'r') as f:
- geo = json.load(f)
-
-
-def unique_rows(data):
- v = data.view(data.dtype.descr * data.shape[1])
- _, idx = np.unique(v, return_index=True)
- return data[np.sort(idx)]
-
-
-def add(P, color):
- P = np.array(P)
- if len(P) < 2:
- return
- P = np.array(P) / 20.0 + (5, -2)
- p = np.zeros((len(P), 3))
- p[:, :2] = P
- p = unique_rows(p)
- if len(p) > 1:
- paths.append(p, closed=True)
- if len(p) > 2:
- polys.append(p, color=color)
-
-
-# Create the canvas.
-canvas = app.Canvas(size=(800, 800), keys='interactive')
-gloo.set_viewport(0, 0, canvas.size[0], canvas.size[1])
-gloo.set_state("translucent", depth_test=False)
-
-panzoom = PanZoomTransform(canvas, aspect=1)
-paths = PathCollection(mode="agg+", color="global", transform=panzoom)
-polys = PolygonCollection("raw", color="local", transform=panzoom)
-paths.update.connect(canvas.update)
-
-for feature in geo["features"]:
- if feature["geometry"]["type"] == 'Polygon':
- path = feature["geometry"]["coordinates"]
- rgba = np.random.uniform(0.5, .8, 4)
- rgba[3] = 1
- add(path[0], color=rgba)
-
- elif feature["geometry"]["type"] == 'MultiPolygon':
- coordinates = feature["geometry"]["coordinates"]
- for path in coordinates:
- rgba = np.random.uniform(0.5, .8, 4)
- rgba[3] = 1
- add(path[0], color=rgba)
-
-paths["color"] = 0, 0, 0, 1
-paths["linewidth"] = 1.0
-paths['viewport'] = 0, 0, 800, 800
-
-
- at canvas.connect
-def on_draw(e):
- gloo.clear('white')
- polys.draw()
- paths.draw()
-
-
- at canvas.connect
-def on_resize(event):
- width, height = event.size
- gloo.set_viewport(0, 0, width, height)
- paths['viewport'] = 0, 0, width, height
-
-if __name__ == '__main__':
- canvas.show()
- app.run()
diff --git a/examples/collections/path_collection.py b/examples/collections/path_collection.py
deleted file mode 100644
index b685d6a..0000000
--- a/examples/collections/path_collection.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: testskip
-
-import numpy as np
-from vispy import app, gloo
-from vispy.visuals.collections import PathCollection
-
-c = app.Canvas(size=(800, 800), show=True, keys='interactive')
-gloo.set_viewport(0, 0, c.size[0], c.size[1])
-gloo.set_state("translucent", depth_test=False)
-
-
-def star(inner=0.5, outer=1.0, n=5):
- R = np.array([inner, outer] * n)
- T = np.linspace(0, 2 * np.pi, 2 * n, endpoint=False)
- P = np.zeros((2 * n, 3))
- P[:, 0] = R * np.cos(T)
- P[:, 1] = R * np.sin(T)
- return P
-
-
-n = 2500
-S = star(n=5)
-P = np.tile(S.ravel(), n).reshape(n, len(S), 3)
-P *= np.random.uniform(5, 10, n)[:, np.newaxis, np.newaxis]
-P[:, :, :2] += np.random.uniform(0, 800, (n, 2))[:, np.newaxis, :]
-P = P.reshape(n * len(S), 3)
-P = 2 * (P / (800, 800, 1)) - 1
-
-paths = PathCollection(mode="agg")
-paths.append(P, closed=True, itemsize=len(S))
-paths["linewidth"] = 1.0
-paths['viewport'] = 0, 0, 800, 800
-
-
- at c.connect
-def on_draw(e):
- gloo.clear('white')
- paths.draw()
-
-
- at c.connect
-def on_resize(e):
- width, height = e.size[0], e.size[1]
- gloo.set_viewport(0, 0, width, height)
- paths['viewport'] = 0, 0, width, height
-
-app.run()
diff --git a/examples/collections/point_collection.py b/examples/collections/point_collection.py
deleted file mode 100644
index f2280c0..0000000
--- a/examples/collections/point_collection.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: testskip
-
-import sys
-import numpy as np
-from vispy import app, gloo
-from vispy.visuals.collections import PointCollection
-from vispy.visuals.transforms import PanZoomTransform
-
-canvas = app.Canvas(size=(800, 600), show=True, keys='interactive')
-gloo.set_viewport(0, 0, canvas.size[0], canvas.size[1])
-gloo.set_state("translucent", depth_test=False)
-
-panzoom = PanZoomTransform(canvas)
-
-points = PointCollection("agg", color="shared", transform=panzoom)
-points.append(np.random.normal(0.0, 0.5, (10000, 3)), itemsize=5000)
-points["color"] = (1, 0, 0, 1), (0, 0, 1, 1)
-points.update.connect(canvas.update)
-
-
- at canvas.connect
-def on_draw(event):
- gloo.clear('white')
- points.draw()
-
-
- at canvas.connect
-def on_resize(event):
- width, height = event.size
- gloo.set_viewport(0, 0, width, height)
-
-if __name__ == '__main__' and sys.flags.interactive == 0:
- app.run()
diff --git a/examples/collections/polygon_collection.py b/examples/collections/polygon_collection.py
deleted file mode 100644
index 5938897..0000000
--- a/examples/collections/polygon_collection.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: testskip
-
-import numpy as np
-from vispy import app, gloo
-from vispy.visuals.collections import PathCollection, PolygonCollection
-
-
-canvas = app.Canvas(size=(800, 800), show=True, keys='interactive')
-gloo.set_viewport(0, 0, canvas.size[0], canvas.size[1])
-gloo.set_state("translucent", depth_test=False)
-
-
-def star(inner=0.5, outer=1.0, n=5):
- R = np.array([inner, outer] * n)
- T = np.linspace(0, 2 * np.pi, 2 * n, endpoint=False)
- P = np.zeros((2 * n, 3))
- P[:, 0] = R * np.cos(T)
- P[:, 1] = R * np.sin(T)
- return P
-
-paths = PathCollection("agg", color='shared')
-polys = PolygonCollection("raw", color='shared')
-
-P = star()
-
-n = 100
-for i in range(n):
- c = i / float(n)
- x, y = np.random.uniform(-1, +1, 2)
- s = 100 / 800.0
- polys.append(P * s + (x, y, i / 1000.), color=(1, 0, 0, .5))
- paths.append(
- P * s + (x, y, (i - 1) / 1000.), closed=True, color=(0, 0, 0, .5))
-
-paths["linewidth"] = 1.0
-paths['viewport'] = 0, 0, 800, 800
-
-
- at canvas.connect
-def on_draw(e):
- gloo.clear('white')
- polys.draw()
- paths.draw()
-
-
- at canvas.connect
-def on_resize(event):
- width, height = event.size
- gloo.set_viewport(0, 0, width, height)
- paths['viewport'] = 0, 0, width, height
-
-app.run()
diff --git a/examples/collections/segment_collection.py b/examples/collections/segment_collection.py
deleted file mode 100644
index 6641bc3..0000000
--- a/examples/collections/segment_collection.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: testskip
-
-import numpy as np
-from vispy import app, gloo
-from vispy.visuals.collections import SegmentCollection
-
-
-c = app.Canvas(size=(1200, 600), show=True, keys='interactive')
-gloo.set_viewport(0, 0, c.size[0], c.size[1])
-gloo.set_state("translucent", depth_test=False)
-
-segments = SegmentCollection("agg", linewidth="local")
-n = 100
-P0 = np.dstack(
- (np.linspace(100, 1100, n), np.ones(n) * 50, np.zeros(n))).reshape(n, 3)
-P0 = 2 * (P0 / (1200, 600, 1)) - 1
-P1 = np.dstack(
- (np.linspace(110, 1110, n), np.ones(n) * 550, np.zeros(n))).reshape(n, 3)
-P1 = 2 * (P1 / (1200, 600, 1)) - 1
-
-segments.append(P0, P1, linewidth=np.linspace(1, 8, n))
-segments['antialias'] = 1
-segments['viewport'] = 0, 0, 1200, 600
-
-
- at c.connect
-def on_draw(e):
- gloo.clear('white')
- segments.draw()
-
-
- at c.connect
-def on_resize(e):
- width, height = e.size[0], e.size[1]
- gloo.set_viewport(0, 0, width, height)
- segments['viewport'] = 0, 0, width, height
-
-app.run()
diff --git a/examples/collections/tiger.py b/examples/collections/tiger.py
deleted file mode 100644
index 1182f74..0000000
--- a/examples/collections/tiger.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2014, Nicolas P. Rougier. All Rights Reserved.
-# Distributed under the (new) BSD License.
-# -----------------------------------------------------------------------------
-
-from vispy import app, gloo
-from vispy.util import load_data_file
-from vispy.util.svg import Document
-from vispy.visuals.collections import PathCollection, PolygonCollection
-from vispy.visuals.transforms import PanZoomTransform
-
-path = load_data_file('tiger/tiger.svg')
-tiger = Document(path)
-
-width, height = int(tiger.viewport.width), int(tiger.viewport.height)
-canvas = app.Canvas(size=(width, height), show=True, keys='interactive')
-gloo.set_viewport(0, 0, width, height)
-gloo.set_state("translucent", depth_test=True)
-
-panzoom = PanZoomTransform(canvas, aspect=1.0)
-paths = PathCollection(
- "agg+", linewidth='shared', color="shared", transform=panzoom)
-polys = PolygonCollection("agg", transform=panzoom)
-paths.update.connect(canvas.update)
-
-z = 0
-for path in tiger.paths:
- for vertices, closed in path.vertices:
-
- vertices = 2 * (vertices / (width, height, 1)) - 1
- vertices[:, 1] = -vertices[:, 1]
- if len(vertices) < 3:
- continue
- if path.style.stroke is not None:
- vertices[:, 2] = z - 0.5 / 1000.
- if path.style.stroke_width:
- stroke_width = path.style.stroke_width.value
- else:
- stroke_width = 2.0
- paths.append(vertices, closed=closed, color=path.style.stroke.rgba,
- linewidth=stroke_width)
- if path.style.fill is not None:
- if path.style.stroke is None:
- vertices[:, 2] = z - 0.25 / 1000.
- paths.append(vertices, closed=closed,
- color=path.style.fill.rgba,
- linewidth=1)
- vertices[:, 2] = z
- polys.append(vertices, color=path.style.fill.rgba)
- z -= 1 / 1000.
-
-
-paths["linewidth"] = 1.0
-paths['viewport'] = 0, 0, 800, 800
-
-
- at canvas.connect
-def on_draw(e):
- gloo.clear('white')
- polys.draw()
- paths.draw()
-
-
- at canvas.connect
-def on_resize(e):
- width, height = e.size[0], e.size[1]
- gloo.set_viewport(0, 0, width, height)
- paths['viewport'] = 0, 0, width, height
-
-if __name__ == '__main__':
- canvas.show()
- app.run()
diff --git a/examples/collections/triangle_collection.py b/examples/collections/triangle_collection.py
deleted file mode 100644
index 844b66d..0000000
--- a/examples/collections/triangle_collection.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: testskip
-
-import numpy as np
-from vispy import app, gloo
-from vispy.geometry import Triangulation
-from vispy.visuals.collections import PathCollection, TriangleCollection
-
-canvas = app.Canvas(size=(800, 800), show=True, keys='interactive')
-gloo.set_viewport(0, 0, canvas.size[0], canvas.size[1])
-gloo.set_state("translucent", depth_test=False)
-
-
-def triangulate(P):
- n = len(P)
- S = np.repeat(np.arange(n + 1), 2)[1:-1]
- S[-2:] = n - 1, 0
- S = S.reshape(len(S) / 2, 2)
- T = Triangulation(P[:, :2], S)
- T.triangulate()
- points = T.pts
- triangles = T.tris.ravel()
- P = np.zeros((len(points), 3), dtype=np.float32)
- P[:, :2] = points
- return P, triangles
-
-
-def star(inner=0.5, outer=1.0, n=5):
- R = np.array([inner, outer] * n)
- T = np.linspace(0, 2 * np.pi, 2 * n, endpoint=False)
- P = np.zeros((2 * n, 3))
- P[:, 0] = R * np.cos(T)
- P[:, 1] = R * np.sin(T)
- return P
-
-paths = PathCollection("agg", color='shared')
-triangles = TriangleCollection("raw", color='shared')
-
-P0 = star()
-P1, I = triangulate(P0)
-
-n = 1000
-for i in range(n):
- c = i / float(n)
- x, y = np.random.uniform(-1, +1, 2)
- s = 25 / 800.0
- triangles.append(P1 * s + (x, y, i / 1000.), I, color=(1, 0, 0, .5))
- paths.append(
- P0 * s + (x, y, (i - 1) / 1000.), closed=True, color=(0, 0, 0, .5))
-
-paths["linewidth"] = 1.0
-paths['viewport'] = 0, 0, 800, 800
-
-
- at canvas.connect
-def on_draw(e):
- gloo.clear('white')
- triangles.draw()
- paths.draw()
-
-
- at canvas.connect
-def on_resize(event):
- width, height = event.size
- gloo.set_viewport(0, 0, width, height)
- paths['viewport'] = 0, 0, width, height
-
-app.run()
diff --git a/examples/demo/gloo/atom.py b/examples/demo/gloo/atom.py
deleted file mode 100644
index 5f2025d..0000000
--- a/examples/demo/gloo/atom.py
+++ /dev/null
@@ -1,171 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 06/03/2014
-# Abstract: Fake electrons orbiting
-# Keywords: Sprites, atom, particles
-# -----------------------------------------------------------------------------
-
-import numpy as np
-from vispy import gloo
-from vispy import app
-from vispy.util.transforms import perspective, translate, rotate
-
-# Create vertices
-n, p = 100, 150
-data = np.zeros(p * n, [('a_position', np.float32, 2),
- ('a_color', np.float32, 4),
- ('a_rotation', np.float32, 4)])
-trail = .5 * np.pi
-data['a_position'][:, 0] = np.resize(np.linspace(0, trail, n), p * n)
-data['a_position'][:, 0] += np.repeat(np.random.uniform(0, 2 * np.pi, p), n)
-data['a_position'][:, 1] = np.repeat(np.linspace(0, 2 * np.pi, p), n)
-
-data['a_color'] = 1, 1, 1, 1
-data['a_color'] = np.repeat(
- np.random.uniform(0.75, 1.00, (p, 4)).astype(np.float32), n, axis=0)
-data['a_color'][:, 3] = np.resize(np.linspace(0, 1, n), p * n)
-
-data['a_rotation'] = np.repeat(
- np.random.uniform(0, 2 * np.pi, (p, 4)).astype(np.float32), n, axis=0)
-
-
-vert = """
-#version 120
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform float u_size;
-uniform float u_clock;
-
-attribute vec2 a_position;
-attribute vec4 a_color;
-attribute vec4 a_rotation;
-varying vec4 v_color;
-
-mat4 build_rotation(vec3 axis, float angle)
-{
- axis = normalize(axis);
- float s = sin(angle);
- float c = cos(angle);
- float oc = 1.0 - c;
- return mat4(oc * axis.x * axis.x + c,
- oc * axis.x * axis.y - axis.z * s,
- oc * axis.z * axis.x + axis.y * s,
- 0.0,
- oc * axis.x * axis.y + axis.z * s,
- oc * axis.y * axis.y + c,
- oc * axis.y * axis.z - axis.x * s,
- 0.0,
- oc * axis.z * axis.x - axis.y * s,
- oc * axis.y * axis.z + axis.x * s,
- oc * axis.z * axis.z + c,
- 0.0,
- 0.0, 0.0, 0.0, 1.0);
-}
-
-
-void main (void) {
- v_color = a_color;
-
- float x0 = 1.5;
- float z0 = 0.0;
-
- float theta = a_position.x + u_clock;
- float x1 = x0*cos(theta) + z0*sin(theta);
- float y1 = 0.0;
- float z1 = (z0*cos(theta) - x0*sin(theta))/2.0;
-
- mat4 R = build_rotation(a_rotation.xyz, a_rotation.w);
- gl_Position = u_projection * u_view * u_model * R * vec4(x1,y1,z1,1);
- gl_PointSize = 8.0 * u_size * sqrt(v_color.a);
-}
-"""
-
-frag = """
-#version 120
-varying vec4 v_color;
-varying float v_size;
-void main()
-{
- float d = 2*(length(gl_PointCoord.xy - vec2(0.5,0.5)));
- gl_FragColor = vec4(v_color.rgb, v_color.a*(1-d));
-}
-"""
-
-
-# ------------------------------------------------------------ Canvas class ---
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 800))
- self.title = "Atom [zoom with mouse scroll"
-
- self.translate = 6.5
- self.program = gloo.Program(vert, frag)
- self.view = translate((0, 0, -self.translate))
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
- self.apply_zoom()
-
- self.program.bind(gloo.VertexBuffer(data))
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
- self.program['u_size'] = 5 / self.translate
-
- self.theta = 0
- self.phi = 0
- self.clock = 0
- self.stop_rotation = False
-
- gloo.set_state('translucent', depth_test=False)
- self.program['u_clock'] = 0.0
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def on_key_press(self, event):
- if event.text == ' ':
- self.stop_rotation = not self.stop_rotation
-
- def on_timer(self, event):
- if not self.stop_rotation:
- self.theta += .05
- self.phi += .05
- self.model = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.program['u_model'] = self.model
- self.clock += np.pi / 100
- self.program['u_clock'] = self.clock
- self.update()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def on_mouse_wheel(self, event):
- self.translate += event.delta[1]
- self.translate = max(2, self.translate)
- self.view = translate((0, 0, -self.translate))
- self.program['u_view'] = self.view
- self.program['u_size'] = 5 / self.translate
- self.update()
-
- def on_draw(self, event):
- gloo.clear('black')
- self.program.draw('points')
-
- def apply_zoom(self):
- width, height = self.physical_size
- gloo.set_viewport(0, 0, width, height)
- self.projection = perspective(45.0, width / float(height), 1.0, 1000.0)
- self.program['u_projection'] = self.projection
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/boids.py b/examples/demo/gloo/boids.py
deleted file mode 100644
index c10e223..0000000
--- a/examples/demo/gloo/boids.py
+++ /dev/null
@@ -1,192 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-
-"""
-Demonstration of boids simulation. Boids is an artificial life
-program, developed by Craig Reynolds in 1986, which simulates the
-flocking behaviour of birds.
-Based on code from glumpy by Nicolas Rougier.
-"""
-
-import time
-
-import numpy as np
-from scipy.spatial import cKDTree
-
-from vispy import gloo
-from vispy import app
-
-VERT_SHADER = """
-#version 120
-attribute vec3 position;
-attribute vec4 color;
-attribute float size;
-
-varying vec4 v_color;
-void main (void) {
- gl_Position = vec4(position, 1.0);
- v_color = color;
- gl_PointSize = size;
-}
-"""
-
-FRAG_SHADER = """
-#version 120
-varying vec4 v_color;
-void main()
-{
- float x = 2.0*gl_PointCoord.x - 1.0;
- float y = 2.0*gl_PointCoord.y - 1.0;
- float a = 1.0 - (x*x + y*y);
- gl_FragColor = vec4(v_color.rgb, a*v_color.a);
-}
-
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
-
- ps = self.pixel_scale
-
- # Create boids
- n = 1000
- self.particles = np.zeros(2 + n, [('position', 'f4', 3),
- ('position_1', 'f4', 3),
- ('position_2', 'f4', 3),
- ('velocity', 'f4', 3),
- ('color', 'f4', 4),
- ('size', 'f4', 1*ps)])
- self.boids = self.particles[2:]
- self.target = self.particles[0]
- self.predator = self.particles[1]
-
- self.boids['position'] = np.random.uniform(-0.25, +0.25, (n, 3))
- self.boids['velocity'] = np.random.uniform(-0.00, +0.00, (n, 3))
- self.boids['size'] = 4*ps
- self.boids['color'] = 1, 1, 1, 1
-
- self.target['size'] = 16*ps
- self.target['color'][:] = 1, 1, 0, 1
- self.predator['size'] = 16*ps
- self.predator['color'][:] = 1, 0, 0, 1
- self.target['position'][:] = 0.25, 0.0, 0
-
- # Time
- self._t = time.time()
- self._pos = 0.0, 0.0
- self._button = None
-
- width, height = self.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- # Create program
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
-
- # Create vertex buffers
- self.vbo_position = gloo.VertexBuffer(self.particles['position']
- .copy())
- self.vbo_color = gloo.VertexBuffer(self.particles['color'].copy())
- self.vbo_size = gloo.VertexBuffer(self.particles['size'].copy())
-
- # Bind vertex buffers
- self.program['color'] = self.vbo_color
- self.program['size'] = self.vbo_size
- self.program['position'] = self.vbo_position
-
- gloo.set_state(clear_color=(0, 0, 0, 1), blend=True,
- blend_func=('src_alpha', 'one'))
-
- self._timer = app.Timer('auto', connect=self.update, start=True)
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- def on_mouse_press(self, event):
- self._button = event.button
- self.on_mouse_move(event)
-
- def on_mouse_release(self, event):
- self._button = None
- self.on_mouse_move(event)
-
- def on_mouse_move(self, event):
- if not self._button:
- return
- w, h = self.size
- x, y = event.pos
- sx = 2 * x / float(w) - 1.0
- sy = - (2 * y / float(h) - 1.0)
-
- if self._button == 1:
- self.target['position'][:] = sx, sy, 0
- elif self._button == 2:
- self.predator['position'][:] = sx, sy, 0
-
- def on_draw(self, event):
- gloo.clear()
- # Draw
- self.program.draw('points')
- # Next iteration
- self._t = self.iteration(time.time() - self._t)
-
- def iteration(self, dt):
- t = self._t
-
- t += 0.5 * dt
- #self.target[...] = np.array([np.sin(t),np.sin(2*t),np.cos(3*t)])*.1
-
- t += 0.5 * dt
- #self.predator[...] = np.array([np.sin(t),np.sin(2*t),np.cos(3*t)])*.2
-
- self.boids['position_2'] = self.boids['position_1']
- self.boids['position_1'] = self.boids['position']
- n = len(self.boids)
- P = self.boids['position']
- V = self.boids['velocity']
-
- # Cohesion: steer to move toward the average position of local
- # flockmates
- C = -(P - P.sum(axis=0) / n)
-
- # Alignment: steer towards the average heading of local flockmates
- A = -(V - V.sum(axis=0) / n)
-
- # Repulsion: steer to avoid crowding local flockmates
- D, I = cKDTree(P).query(P, 5)
- M = np.repeat(D < 0.05, 3, axis=1).reshape(n, 5, 3)
- Z = np.repeat(P, 5, axis=0).reshape(n, 5, 3)
- R = -((P[I] - Z) * M).sum(axis=1)
-
- # Target : Follow target
- T = self.target['position'] - P
-
- # Predator : Move away from predator
- dP = P - self.predator['position']
- D = np.maximum(0, 0.3 -
- np.sqrt(dP[:, 0] ** 2 +
- dP[:, 1] ** 2 +
- dP[:, 2] ** 2))
- D = np.repeat(D, 3, axis=0).reshape(n, 3)
- dP *= D
-
- #self.boids['velocity'] += 0.0005*C + 0.01*A + 0.01*R +
- # 0.0005*T + 0.0025*dP
- self.boids['velocity'] += 0.0005 * C + 0.01 * \
- A + 0.01 * R + 0.0005 * T + 0.025 * dP
- self.boids['position'] += self.boids['velocity']
-
- self.vbo_position.set_data(self.particles['position'].copy())
-
- return t
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/brain.py b/examples/demo/gloo/brain.py
deleted file mode 100644
index a863950..0000000
--- a/examples/demo/gloo/brain.py
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 2
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-3D brain mesh viewer.
-"""
-
-from timeit import default_timer
-import numpy as np
-
-from vispy import gloo
-from vispy import app
-from vispy.util.transforms import perspective, translate, rotate
-from vispy.io import load_data_file
-
-brain = np.load(load_data_file('brain/brain.npz', force_download='2014-09-04'))
-data = brain['vertex_buffer']
-faces = brain['index_buffer']
-
-VERT_SHADER = """
-#version 120
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform vec4 u_color;
-
-attribute vec3 a_position;
-attribute vec3 a_normal;
-attribute vec4 a_color;
-
-varying vec3 v_position;
-varying vec3 v_normal;
-varying vec4 v_color;
-
-void main()
-{
- v_normal = a_normal;
- v_position = a_position;
- v_color = a_color * u_color;
- gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);
-}
-"""
-
-FRAG_SHADER = """
-#version 120
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_normal;
-
-uniform vec3 u_light_intensity;
-uniform vec3 u_light_position;
-
-varying vec3 v_position;
-varying vec3 v_normal;
-varying vec4 v_color;
-
-void main()
-{
- // Calculate normal in world coordinates
- vec3 normal = normalize(u_normal * vec4(v_normal,1.0)).xyz;
-
- // Calculate the location of this fragment (pixel) in world coordinates
- vec3 position = vec3(u_view*u_model * vec4(v_position, 1));
-
- // Calculate the vector from this pixels surface to the light source
- vec3 surfaceToLight = u_light_position - position;
-
- // Calculate the cosine of the angle of incidence (brightness)
- float brightness = dot(normal, surfaceToLight) /
- (length(surfaceToLight) * length(normal));
- brightness = max(min(brightness,1.0),0.0);
-
- // Calculate final color of the pixel, based on:
- // 1. The angle of incidence: brightness
- // 2. The color/intensities of the light: light.intensities
- // 3. The texture and texture coord: texture(tex, fragTexCoord)
-
- // Specular lighting.
- vec3 surfaceToCamera = vec3(0.0, 0.0, 1.0) - position;
- vec3 K = normalize(normalize(surfaceToLight) + normalize(surfaceToCamera));
- float specular = clamp(pow(abs(dot(normal, K)), 40.), 0.0, 1.0);
-
- gl_FragColor = v_color * brightness * vec4(u_light_intensity, 1);
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
- self.size = 800, 600
-
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
-
- self.theta, self.phi = -80, 180
- self.translate = 3
-
- self.faces = gloo.IndexBuffer(faces)
- self.program.bind(gloo.VertexBuffer(data))
-
- self.program['u_color'] = 1, 1, 1, 1
- self.program['u_light_position'] = (1., 1., 1.)
- self.program['u_light_intensity'] = (1., 1., 1.)
-
- self.apply_zoom()
-
- gloo.set_state(blend=False, depth_test=True, polygon_offset_fill=True)
-
- self._t0 = default_timer()
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.update_matrices()
-
- def update_matrices(self):
- self.view = translate((0, 0, -self.translate))
- self.model = np.dot(rotate(self.theta, (1, 0, 0)),
- rotate(self.phi, (0, 1, 0)))
- self.projection = np.eye(4, dtype=np.float32)
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
- self.program['u_normal'] = np.linalg.inv(np.dot(self.view,
- self.model)).T
-
- def on_timer(self, event):
- elapsed = default_timer() - self._t0
- self.phi = 180 + elapsed * 50.
- self.update_matrices()
- self.update()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def on_mouse_wheel(self, event):
- self.translate += -event.delta[1]/5.
- self.translate = max(2, self.translate)
- self.update_matrices()
- self.update()
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('triangles', indices=self.faces)
-
- def apply_zoom(self):
- gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])
- self.projection = perspective(45.0, self.size[0] /
- float(self.size[1]), 1.0, 20.0)
- self.program['u_projection'] = self.projection
-
-if __name__ == '__main__':
- c = Canvas()
- c.show()
- app.run()
diff --git a/examples/demo/gloo/camera.py b/examples/demo/gloo/camera.py
deleted file mode 100644
index 9c07a29..0000000
--- a/examples/demo/gloo/camera.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""Display a live webcam feed. Require OpenCV (Python 2 only).
-"""
-
-try:
- import cv2
-except Exception:
- raise ImportError("You need OpenCV for this example.")
-
-import numpy as np
-from vispy import app
-from vispy import gloo
-
-vertex = """
- attribute vec2 position;
- attribute vec2 texcoord;
- varying vec2 v_texcoord;
- void main()
- {
- gl_Position = vec4(position, 0.0, 1.0);
- v_texcoord = texcoord;
- }
-"""
-
-fragment = """
- uniform sampler2D texture;
- varying vec2 v_texcoord;
- void main()
- {
- gl_FragColor = texture2D(texture, v_texcoord);
-
- // HACK: the image is in BGR instead of RGB.
- float temp = gl_FragColor.r;
- gl_FragColor.r = gl_FragColor.b;
- gl_FragColor.b = temp;
- }
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(640, 480), keys='interactive')
- self.program = gloo.Program(vertex, fragment, count=4)
- self.program['position'] = [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
- self.program['texcoord'] = [(1, 1), (1, 0), (0, 1), (0, 0)]
- self.program['texture'] = np.zeros((480, 640, 3)).astype(np.uint8)
-
- width, height = self.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- self.cap = cv2.VideoCapture(0)
- if not self.cap.isOpened():
- raise Exception("There's no available camera.")
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- def on_draw(self, event):
- gloo.clear('black')
- _, im = self.cap.read()
- self.program['texture'][...] = im
- self.program.draw('triangle_strip')
-
- def on_timer(self, event):
- self.update()
-
-c = Canvas()
-app.run()
-c.cap.release()
diff --git a/examples/demo/gloo/cloud.py b/examples/demo/gloo/cloud.py
deleted file mode 100644
index b48cbea..0000000
--- a/examples/demo/gloo/cloud.py
+++ /dev/null
@@ -1,298 +0,0 @@
-# !/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 1
-
-"""
-Demonstrating a cloud of points.
-"""
-
-import numpy as np
-
-from vispy import gloo
-from vispy import app
-from vispy.util.transforms import perspective, translate, rotate
-
-vert = """
-#version 120
-
-// Uniforms
-// ------------------------------------
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform float u_linewidth;
-uniform float u_antialias;
-uniform float u_size;
-
-// Attributes
-// ------------------------------------
-attribute vec3 a_position;
-attribute vec4 a_fg_color;
-attribute vec4 a_bg_color;
-attribute float a_size;
-
-// Varyings
-// ------------------------------------
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_size;
-varying float v_linewidth;
-varying float v_antialias;
-
-void main (void) {
- v_size = a_size * u_size;
- v_linewidth = u_linewidth;
- v_antialias = u_antialias;
- v_fg_color = a_fg_color;
- v_bg_color = a_bg_color;
- gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);
- gl_PointSize = v_size + 2*(v_linewidth + 1.5*v_antialias);
-}
-"""
-
-frag = """
-#version 120
-
-// Constants
-// ------------------------------------
-
-
-// Varyings
-// ------------------------------------
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_size;
-varying float v_linewidth;
-varying float v_antialias;
-
-// Functions
-// ------------------------------------
-
-// ----------------
-float disc(vec2 P, float size)
-{
- float r = length((P.xy - vec2(0.5,0.5))*size);
- r -= v_size/2;
- return r;
-}
-
-// ----------------
-float arrow_right(vec2 P, float size)
-{
- float r1 = abs(P.x -.50)*size + abs(P.y -.5)*size - v_size/2;
- float r2 = abs(P.x -.25)*size + abs(P.y -.5)*size - v_size/2;
- float r = max(r1,-r2);
- return r;
-}
-
-// ----------------
-float ring(vec2 P, float size)
-{
- float r1 = length((gl_PointCoord.xy - vec2(0.5,0.5))*size) - v_size/2;
- float r2 = length((gl_PointCoord.xy - vec2(0.5,0.5))*size) - v_size/4;
- float r = max(r1,-r2);
- return r;
-}
-
-// ----------------
-float clober(vec2 P, float size)
-{
- const float PI = 3.14159265358979323846264;
- const float t1 = -PI/2;
- const vec2 c1 = 0.2*vec2(cos(t1),sin(t1));
- const float t2 = t1+2*PI/3;
- const vec2 c2 = 0.2*vec2(cos(t2),sin(t2));
- const float t3 = t2+2*PI/3;
- const vec2 c3 = 0.2*vec2(cos(t3),sin(t3));
-
- float r1 = length((gl_PointCoord.xy- vec2(0.5,0.5) - c1)*size);
- r1 -= v_size/3;
- float r2 = length((gl_PointCoord.xy- vec2(0.5,0.5) - c2)*size);
- r2 -= v_size/3;
- float r3 = length((gl_PointCoord.xy- vec2(0.5,0.5) - c3)*size);
- r3 -= v_size/3;
- float r = min(min(r1,r2),r3);
- return r;
-}
-
-// ----------------
-float square(vec2 P, float size)
-{
- float r = max(abs(gl_PointCoord.x -.5)*size,
- abs(gl_PointCoord.y -.5)*size);
- r -= v_size/2;
- return r;
-}
-
-// ----------------
-float diamond(vec2 P, float size)
-{
- float r = abs(gl_PointCoord.x -.5)*size + abs(gl_PointCoord.y -.5)*size;
- r -= v_size/2;
- return r;
-}
-
-// ----------------
-float vbar(vec2 P, float size)
-{
- float r1 = max(abs(gl_PointCoord.x -.75)*size,
- abs(gl_PointCoord.x -.25)*size);
- float r3 = max(abs(gl_PointCoord.x -.5)*size,
- abs(gl_PointCoord.y -.5)*size);
- float r = max(r1,r3);
- r -= v_size/2;
- return r;
-}
-
-// ----------------
-float hbar(vec2 P, float size)
-{
- float r2 = max(abs(gl_PointCoord.y -.75)*size,
- abs(gl_PointCoord.y -.25)*size);
- float r3 = max(abs(gl_PointCoord.x -.5)*size,
- abs(gl_PointCoord.y -.5)*size);
- float r = max(r2,r3);
- r -= v_size/2;
- return r;
-}
-
-// ----------------
-float cross(vec2 P, float size)
-{
- float r1 = max(abs(gl_PointCoord.x -.75)*size,
- abs(gl_PointCoord.x -.25)*size);
- float r2 = max(abs(gl_PointCoord.y -.75)*size,
- abs(gl_PointCoord.y -.25)*size);
- float r3 = max(abs(gl_PointCoord.x -.5)*size,
- abs(gl_PointCoord.y -.5)*size);
- float r = max(min(r1,r2),r3);
- r -= v_size/2;
- return r;
-}
-
-
-// Main
-// ------------------------------------
-void main()
-{
- float size = v_size +2*(v_linewidth + 1.5*v_antialias);
- float t = v_linewidth/2.0-v_antialias;
-
- float r = disc(gl_PointCoord, size);
- // float r = square(gl_PointCoord, size);
- // float r = ring(gl_PointCoord, size);
- // float r = arrow_right(gl_PointCoord, size);
- // float r = diamond(gl_PointCoord, size);
- // float r = cross(gl_PointCoord, size);
- // float r = clober(gl_PointCoord, size);
- // float r = hbar(gl_PointCoord, size);
- // float r = vbar(gl_PointCoord, size);
-
-
- float d = abs(r) - t;
- if( r > (v_linewidth/2.0+v_antialias))
- {
- discard;
- }
- else if( d < 0.0 )
- {
- gl_FragColor = v_fg_color;
- }
- else
- {
- float alpha = d/v_antialias;
- alpha = exp(-alpha*alpha);
- if (r > 0)
- gl_FragColor = vec4(v_fg_color.rgb, alpha*v_fg_color.a);
- else
- gl_FragColor = mix(v_bg_color, v_fg_color, alpha);
- }
-}
-"""
-
-
-# ------------------------------------------------------------ Canvas class ---
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 600))
- ps = self.pixel_scale
-
- # Create vertices
- n = 1000000
- data = np.zeros(n, [('a_position', np.float32, 3),
- ('a_bg_color', np.float32, 4),
- ('a_fg_color', np.float32, 4),
- ('a_size', np.float32, 1)])
- data['a_position'] = 0.45 * np.random.randn(n, 3)
- data['a_bg_color'] = np.random.uniform(0.85, 1.00, (n, 4))
- data['a_fg_color'] = 0, 0, 0, 1
- data['a_size'] = np.random.uniform(5*ps, 10*ps, n)
- u_linewidth = 1.0
- u_antialias = 1.0
-
- self.translate = 5
- self.program = gloo.Program(vert, frag)
- self.view = translate((0, 0, -self.translate))
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
-
- self.apply_zoom()
-
- self.program.bind(gloo.VertexBuffer(data))
- self.program['u_linewidth'] = u_linewidth
- self.program['u_antialias'] = u_antialias
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
- self.program['u_size'] = 5 / self.translate
-
- self.theta = 0
- self.phi = 0
-
- gloo.set_state('translucent', clear_color='white')
-
- self.timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def on_key_press(self, event):
- if event.text == ' ':
- if self.timer.running:
- self.timer.stop()
- else:
- self.timer.start()
-
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- self.model = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.program['u_model'] = self.model
- self.update()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def on_mouse_wheel(self, event):
- self.translate -= event.delta[1]
- self.translate = max(2, self.translate)
- self.view = translate((0, 0, -self.translate))
-
- self.program['u_view'] = self.view
- self.program['u_size'] = 5 / self.translate
- self.update()
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('points')
-
- def apply_zoom(self):
- gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])
- self.projection = perspective(45.0, self.size[0] /
- float(self.size[1]), 1.0, 1000.0)
- self.program['u_projection'] = self.projection
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/donut.py b/examples/demo/gloo/donut.py
deleted file mode 100644
index 5af7069..0000000
--- a/examples/demo/gloo/donut.py
+++ /dev/null
@@ -1,194 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# -----------------------------------------------------------------------------
-"""
-Mesmerizing donut
-"""
-
-import numpy as np
-from vispy import gloo
-from vispy import app
-from vispy.util.transforms import perspective, translate, rotate
-
-vert = """
-#version 120
-
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform float u_linewidth;
-uniform float u_antialias;
-uniform float u_size;
-uniform float u_clock;
-
-attribute vec2 a_position;
-attribute vec4 a_fg_color;
-attribute vec4 a_bg_color;
-attribute float a_size;
-
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_size;
-varying float v_linewidth;
-varying float v_antialias;
-
-void main (void) {
- v_size = a_size * u_size;
- v_linewidth = u_linewidth;
- v_antialias = u_antialias;
- v_fg_color = a_fg_color;
- v_bg_color = a_bg_color;
-
- float x0 = 0.5;
- float z0 = 0.0;
-
- float theta = a_position.x + u_clock;
- float x1 = x0*cos(theta) + z0*sin(theta) - 1.0;
- float y1 = 0.0;
- float z1 = z0*cos(theta) - x0*sin(theta);
-
- float phi = a_position.y;
- float x2 = x1*cos(phi) + y1*sin(phi);
- float y2 = y1*cos(phi) - x1*sin(phi);
- float z2 = z1;
-
- gl_Position = u_projection * u_view * u_model * vec4(x2,y2,z2,1);
- gl_PointSize = v_size + 2*(v_linewidth + 1.5*v_antialias);
-}
-"""
-
-frag = """
-#version 120
-
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_size;
-varying float v_linewidth;
-varying float v_antialias;
-void main()
-{
- float size = v_size +2*(v_linewidth + 1.5*v_antialias);
- float t = v_linewidth/2.0-v_antialias;
- float r = length((gl_PointCoord.xy - vec2(0.5,0.5))*size) - v_size/2;
- float d = abs(r) - t;
- if( r > (v_linewidth/2.0+v_antialias))
- {
- discard;
- }
- else if( d < 0.0 )
- {
- gl_FragColor = v_fg_color;
- }
- else
- {
- float alpha = d/v_antialias;
- alpha = exp(-alpha*alpha);
- if (r > 0)
- gl_FragColor = vec4(v_fg_color.rgb, alpha*v_fg_color.a);
- else
- gl_FragColor = mix(v_bg_color, v_fg_color, alpha);
- }
-}
-"""
-
-
-# ------------------------------------------------------------ Canvas class ---
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 800))
- ps = self.pixel_scale
-
- self.title = "D'oh! A big donut"
-
- # Create vertices
- n, p = 50, 40
- data = np.zeros(p * n, [('a_position', np.float32, 2),
- ('a_bg_color', np.float32, 4),
- ('a_fg_color', np.float32, 4),
- ('a_size', np.float32, 1)])
- data['a_position'][:, 0] = np.resize(np.linspace(
- 0, 2 * np.pi, n), p * n)
- data['a_position'][:, 1] = np.repeat(np.linspace(0, 2 * np.pi, p), n)
- data['a_bg_color'] = np.random.uniform(0.75, 1.00, (n * p, 4))
- data['a_bg_color'][:, 3] = 1
- data['a_fg_color'] = 0, 0, 0, 1
- # data['a_size'] = np.random.uniform(8*ps, 8*ps, n * p)
- data['a_size'] = 8.0*ps
- u_linewidth = 1.0*ps
- u_antialias = 1.0
-
- self.translate = 5
- self.program = gloo.Program(vert, frag)
- self.view = translate((0, 0, -self.translate))
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
-
- self.program.bind(gloo.VertexBuffer(data))
- self.program['u_linewidth'] = u_linewidth
- self.program['u_antialias'] = u_antialias
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
- self.program['u_size'] = 5 / self.translate
-
- self.apply_zoom()
-
- self.theta = 0
- self.phi = 0
- self.clock = 0
- self.stop_rotation = False
-
- gloo.set_state('translucent', clear_color='white')
- self.program['u_clock'] = 0.0
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def on_key_press(self, event):
- if event.text == ' ':
- self.stop_rotation = not self.stop_rotation
-
- def on_timer(self, event):
- if not self.stop_rotation:
- self.theta += .5
- self.phi += .5
- self.model = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.program['u_model'] = self.model
- self.clock += np.pi / 1000
- self.program['u_clock'] = self.clock
- self.update()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def on_mouse_wheel(self, event):
- self.translate -= event.delta[1]
- self.translate = max(2, self.translate)
- self.view = translate((0, 0, -self.translate))
-
- self.program['u_view'] = self.view
- self.program['u_size'] = 5 / self.translate
- self.update()
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('points')
-
- def apply_zoom(self):
- gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])
- self.projection = perspective(45.0, self.size[0] /
- float(self.size[1]), 1.0, 1000.0)
- self.program['u_projection'] = self.projection
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/fireworks.py b/examples/demo/gloo/fireworks.py
deleted file mode 100644
index 0888af4..0000000
--- a/examples/demo/gloo/fireworks.py
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 20
-
-"""
-Example demonstrating simulation of fireworks using point sprites.
-(adapted from the "OpenGL ES 2.0 Programming Guide")
-
-This example demonstrates a series of explosions that last one second. The
-visualization during the explosion is highly optimized using a Vertex Buffer
-Object (VBO). After each explosion, vertex data for the next explosion are
-calculated, such that each explostion is unique.
-"""
-
-import time
-import numpy as np
-from vispy import gloo, app
-
-# import vispy
-# vispy.use('pyside', 'es2')
-
-
-# Create a texture
-radius = 32
-im1 = np.random.normal(
- 0.8, 0.3, (radius * 2 + 1, radius * 2 + 1)).astype(np.float32)
-
-# Mask it with a disk
-L = np.linspace(-radius, radius, 2 * radius + 1)
-(X, Y) = np.meshgrid(L, L)
-im1 *= np.array((X ** 2 + Y ** 2) <= radius * radius, dtype='float32')
-
-# Set number of particles, you should be able to scale this to 100000
-N = 10000
-
-# Create vertex data container
-data = np.zeros(N, [('a_lifetime', np.float32, 1),
- ('a_startPosition', np.float32, 3),
- ('a_endPosition', np.float32, 3)])
-
-
-VERT_SHADER = """
-uniform float u_time;
-uniform vec3 u_centerPosition;
-attribute float a_lifetime;
-attribute vec3 a_startPosition;
-attribute vec3 a_endPosition;
-varying float v_lifetime;
-
-void main () {
- if (u_time <= a_lifetime)
- {
- gl_Position.xyz = a_startPosition + (u_time * a_endPosition);
- gl_Position.xyz += u_centerPosition;
- gl_Position.y -= 1.0 * u_time * u_time;
- gl_Position.w = 1.0;
- }
- else
- gl_Position = vec4(-1000, -1000, 0, 0);
-
- v_lifetime = 1.0 - (u_time / a_lifetime);
- v_lifetime = clamp(v_lifetime, 0.0, 1.0);
- gl_PointSize = (v_lifetime * v_lifetime) * 40.0;
-}
-"""
-
-# Deliberately add precision qualifiers to test automatic GLSL code conversion
-FRAG_SHADER = """
-precision highp float;
-uniform sampler2D texture1;
-uniform vec4 u_color;
-varying float v_lifetime;
-uniform highp sampler2D s_texture;
-
-void main()
-{
- highp vec4 texColor;
- texColor = texture2D(s_texture, gl_PointCoord);
- gl_FragColor = vec4(u_color) * texColor;
- gl_FragColor.a *= v_lifetime;
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 600))
-
- # Create program
- self._program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- self._program.bind(gloo.VertexBuffer(data))
- self._program['s_texture'] = gloo.Texture2D(im1)
-
- # Create first explosion
- self._new_explosion()
-
- # Enable blending
- gloo.set_state(blend=True, clear_color='black',
- blend_func=('src_alpha', 'one'))
-
- gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])
-
- self._timer = app.Timer('auto', connect=self.update, start=True)
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- gloo.set_viewport(0, 0, width, height)
-
- def on_draw(self, event):
-
- # Clear
- gloo.clear()
-
- # Draw
- self._program['u_time'] = time.time() - self._starttime
- self._program.draw('points')
-
- # New explosion?
- if time.time() - self._starttime > 1.5:
- self._new_explosion()
-
- def _new_explosion(self):
-
- # New centerpos
- centerpos = np.random.uniform(-0.5, 0.5, (3,))
- self._program['u_centerPosition'] = centerpos
-
- # New color, scale alpha with N
- alpha = 1.0 / N ** 0.08
- color = np.random.uniform(0.1, 0.9, (3,))
-
- self._program['u_color'] = tuple(color) + (alpha,)
-
- # Create new vertex data
- data['a_lifetime'] = np.random.normal(2.0, 0.5, (N,))
- data['a_startPosition'] = np.random.normal(0.0, 0.2, (N, 3))
- data['a_endPosition'] = np.random.normal(0.0, 1.2, (N, 3))
-
- # Set time to zero
- self._starttime = time.time()
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/galaxy.py b/examples/demo/gloo/galaxy.py
deleted file mode 100644
index e13a663..0000000
--- a/examples/demo/gloo/galaxy.py
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Just a very fake galaxy.
-Astronomers and cosmologists will kill me !
-"""
-
-import numpy as np
-
-from vispy import gloo
-from vispy import app
-from vispy.util.transforms import perspective, translate, rotate
-
-# Manual galaxy creation
-# (did you really expect a simulation in less than 250 python lines ?)
-
-
-def make_arm(n, angle):
- R = np.linspace(10, 450 + 50 * np.random.uniform(.5, 1.), n)
- R += 40 * np.random.normal(0, 2., n) * np.linspace(1, .1, n)
- T = angle + np.linspace(0, 2.5 * np.pi, n) + \
- np.pi / 6 * np.random.normal(0, .5, n)
- S = 8 + 2 * np.abs(np.random.normal(0, 1, n))
- S *= np.linspace(1, .85, n)
- P = np.zeros((n, 3), dtype=np.float32)
- X, Y, Z = P[:, 0], P[:, 1], P[:, 2]
- X[...] = R * np.cos(T)
- Y[...] = R * np.sin(T) * 1.1
- D = np.sqrt(X * X + Y * Y)
- Z[...] = 8 * np.random.normal(0, 2 - D / 512., n)
- X += (D * np.random.uniform(0, 1, n) > 250) * \
- (.05 * D * np.random.uniform(-1, 1, n))
- Y += (D * np.random.uniform(0, 1, n) > 250) * \
- (.05 * D * np.random.uniform(-1, 1, n))
- Z += (D * np.random.uniform(0, 1, n) > 250) * \
- (.05 * D * np.random.uniform(-1, 1, n))
- D = (D - D.min()) / (D.max() - D.min())
-
- return P / 256, S / 2, D
-p = 50000
-n = 3 * p
-
-# Very simple colormap
-cmap = np.array([[255, 124, 0], [255, 163, 76],
- [255, 192, 130], [255, 214, 173],
- [255, 232, 212], [246, 238, 237],
- [237, 240, 253], [217, 228, 255],
- [202, 219, 255], [191, 212, 255],
- [182, 206, 255], [174, 202, 255],
- [168, 198, 255], [162, 195, 255],
- [158, 192, 255], [155, 189, 255],
- [151, 187, 255], [148, 185, 255],
- [145, 183, 255], [143, 182, 255],
- [141, 181, 255], [140, 179, 255],
- [139, 179, 255],
- [137, 177, 255]], dtype=np.uint8).reshape(1, 24, 3)
-
-
-VERT_SHADER = """
-#version 120
-// Uniforms
-// ------------------------------------
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform float u_size;
-
-
-// Attributes
-// ------------------------------------
-attribute vec3 a_position;
-attribute float a_size;
-attribute float a_dist;
-
-// Varyings
-// ------------------------------------
-varying float v_size;
-varying float v_dist;
-
-void main (void) {
- v_size = a_size*u_size*.75;
- v_dist = a_dist;
- gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);
- gl_PointSize = v_size;
-}
-"""
-
-FRAG_SHADER = """
-#version 120
-// Uniforms
-// ------------------------------------
-uniform sampler2D u_colormap;
-
-// Varyings
-// ------------------------------------
-varying float v_size;
-varying float v_dist;
-
-// Main
-// ------------------------------------
-void main()
-{
- float a = 2*(length(gl_PointCoord.xy - vec2(0.5,0.5)) / sqrt(2.0));
- vec3 color = texture2D(u_colormap, vec2(v_dist,.5)).rgb;
- gl_FragColor = vec4(color,(1-a)*.25);
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive', size=(800, 600))
- ps = self.pixel_scale
-
- self.title = "A very fake galaxy [mouse scroll to zoom]"
-
- data = np.zeros(n, [('a_position', np.float32, 3),
- ('a_size', np.float32, 1),
- ('a_dist', np.float32, 1)])
-
- for i in range(3):
- P, S, D = make_arm(p, i * 2 * np.pi / 3)
- data['a_dist'][(i + 0) * p:(i + 1) * p] = D
- data['a_position'][(i + 0) * p:(i + 1) * p] = P
- data['a_size'][(i + 0) * p:(i + 1) * p] = S*ps
-
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
- self.theta, self.phi = 0, 0
-
- self.translate = 5
- self.view = translate((0, 0, -self.translate))
-
- self.program.bind(gloo.VertexBuffer(data))
- self.program['u_colormap'] = gloo.Texture2D(cmap)
- self.program['u_size'] = 5. / self.translate
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
-
- self.apply_zoom()
-
- gloo.set_state(depth_test=False, blend=True,
- blend_func=('src_alpha', 'one'), clear_color='black')
-
- # Start the timer upon initialization.
- self.timer = app.Timer('auto', connect=self.on_timer)
- self.timer.start()
-
- self.show()
-
- def on_key_press(self, event):
- if event.text == ' ':
- if self.timer.running:
- self.timer.stop()
- else:
- self.timer.start()
-
- def on_timer(self, event):
- self.theta += .11
- self.phi += .13
- self.model = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.program['u_model'] = self.model
- self.update()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def on_mouse_wheel(self, event):
- self.translate -= event.delta[1]
- self.translate = max(2, self.translate)
- self.view = translate((0, 0, -self.translate))
- self.program['u_view'] = self.view
- self.program['u_size'] = 5 / self.translate
- self.update()
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('points')
-
- def apply_zoom(self):
- gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])
- self.projection = perspective(45.0, self.size[0] /
- float(self.size[1]), 1.0, 1000.0)
- self.program['u_projection'] = self.projection
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/galaxy/galaxy.py b/examples/demo/gloo/galaxy/galaxy.py
deleted file mode 100755
index 2d39658..0000000
--- a/examples/demo/gloo/galaxy/galaxy.py
+++ /dev/null
@@ -1,205 +0,0 @@
-#!/usr/bin/env python
-import numpy as np
-import sys
-
-from vispy.util.transforms import perspective
-from vispy.util import transforms
-from vispy import gloo
-from vispy import app
-from vispy import io
-
-import galaxy_specrend
-from galaxy_simulation import Galaxy
-
-VERT_SHADER = """
-#version 120
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-
-//sampler that maps [0, n] -> color according to blackbody law
-uniform sampler1D u_colormap;
-//index to sample the colormap at
-attribute float a_color_index;
-
-//size of the star
-attribute float a_size;
-//type
-//type 0 - stars
-//type 1 - dust
-//type 2 - h2a objects
-//type 3 - h2a objects
-attribute float a_type;
-attribute vec2 a_position;
-//brightness of the star
-attribute float a_brightness;
-
-varying vec3 v_color;
-void main (void)
-{
- gl_Position = u_projection * u_view * u_model * vec4(a_position, 0.0,1.0);
-
- //find base color according to physics from our sampler
- vec3 base_color = texture1D(u_colormap, a_color_index).rgb;
- //scale it down according to brightness
- v_color = base_color * a_brightness;
-
-
- if (a_size > 2.0)
- {
- gl_PointSize = a_size;
- } else {
- gl_PointSize = 0.0;
- }
-
- if (a_type == 2) {
- v_color *= vec3(2, 1, 1);
- }
- else if (a_type == 3) {
- v_color = vec3(.9);
- }
-}
-"""
-
-FRAG_SHADER = """
-#version 120
-//star texture
-uniform sampler2D u_texture;
-//predicted color from black body
-varying vec3 v_color;
-
-void main()
-{
- //amount of intensity from the grayscale star
- float star_tex_intensity = texture2D(u_texture, gl_PointCoord).r;
- gl_FragColor = vec4(v_color * star_tex_intensity, 0.8);
-}
-"""
-
-galaxy = Galaxy(10000)
-galaxy.reset(13000, 4000, 0.0004, 0.90, 0.90, 0.5, 200, 300)
-# coldest and hottest temperatures of out galaxy
-t0, t1 = 200.0, 10000.0
-# total number of discrete colors between t0 and t1
-n = 1000
-dt = (t1 - t0) / n
-
-# maps [0, n) -> colors
-# generate a linear interpolation of temperatures
-# then map the temperatures to colors using black body
-# color predictions
-colors = np.zeros(n, dtype=(np.float32, 3))
-for i in range(n):
- temperature = t0 + i * dt
- x, y, z = galaxy_specrend.spectrum_to_xyz(galaxy_specrend.bb_spectrum,
- temperature)
- r, g, b = galaxy_specrend.xyz_to_rgb(galaxy_specrend.SMPTEsystem, x, y, z)
- r = min((max(r, 0), 1))
- g = min((max(g, 0), 1))
- b = min((max(b, 0), 1))
- colors[i] = galaxy_specrend.norm_rgb(r, g, b)
-
-
-# load the PNG that we use to blend the star with
-# to provide a circular look to each star.
-def load_galaxy_star_image():
- fname = io.load_data_file('galaxy/star-particle.png')
- raw_image = io.read_png(fname)
-
- return raw_image
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- # setup initial width, height
- app.Canvas.__init__(self, keys='interactive', size=(800, 600))
-
- # create a new shader program
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER,
- count=len(galaxy))
-
- # load the star texture
- self.texture = gloo.Texture2D(load_galaxy_star_image(),
- interpolation='linear')
- self.program['u_texture'] = self.texture
-
- # construct the model, view and projection matrices
- self.view = transforms.translate((0, 0, -5))
- self.program['u_view'] = self.view
-
- self.model = np.eye(4, dtype=np.float32)
- self.program['u_model'] = self.model
-
- self.program['u_colormap'] = colors
-
- w, h = self.size
- self.projection = perspective(45.0, w / float(h), 1.0, 1000.0)
- self.program['u_projection'] = self.projection
-
- # start the galaxy to some decent point in the future
- galaxy.update(100000)
- data = self.__create_galaxy_vertex_data()
-
- # setup the VBO once the galaxy vertex data has been setup
- # bind the VBO for the first time
- self.data_vbo = gloo.VertexBuffer(data)
- self.program.bind(self.data_vbo)
-
- # setup blending
- gloo.set_state(clear_color=(0.0, 0.0, 0.03, 1.0),
- depth_test=False, blend=True,
- blend_func=('src_alpha', 'one'))
-
- self._timer = app.Timer('auto', connect=self.update, start=True)
-
- def __create_galaxy_vertex_data(self):
- data = np.zeros(len(galaxy),
- dtype=[('a_size', np.float32, 1),
- ('a_position', np.float32, 2),
- ('a_color_index', np.float32, 1),
- ('a_brightness', np.float32, 1),
- ('a_type', np.float32, 1)])
-
- # see shader for parameter explanations
- pw, ph = self.physical_size
- data['a_size'] = galaxy['size'] * max(pw / 800.0, ph / 800.0)
- data['a_position'] = galaxy['position'] / 13000.0
-
- data['a_color_index'] = (galaxy['temperature'] - t0) / (t1 - t0)
- data['a_brightness'] = galaxy['brightness']
- data['a_type'] = galaxy['type']
-
- return data
-
- def on_resize(self, event):
- # setup the new viewport
- gloo.set_viewport(0, 0, *event.physical_size)
- # recompute the projection matrix
- w, h = event.size
- self.projection = perspective(45.0, w / float(h),
- 1.0, 1000.0)
- self.program['u_projection'] = self.projection
-
- def on_draw(self, event):
- # update the galaxy
- galaxy.update(50000) # in years !
-
- # recreate the numpy array that will be sent as the VBO data
- data = self.__create_galaxy_vertex_data()
- # update the VBO
- self.data_vbo.set_data(data)
- # bind the VBO to the GL context
- self.program.bind(self.data_vbo)
-
- # clear the screen and render
- gloo.clear(color=True, depth=True)
- self.program.draw('points')
-
-
-if __name__ == '__main__':
- c = Canvas()
- c.show()
-
- if sys.flags.interactive == 0:
- app.run()
diff --git a/examples/demo/gloo/galaxy/galaxy_simulation.py b/examples/demo/gloo/galaxy/galaxy_simulation.py
deleted file mode 100644
index 912ba52..0000000
--- a/examples/demo/gloo/galaxy/galaxy_simulation.py
+++ /dev/null
@@ -1,235 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-
-# -----------------------------------------------------------------------------
-# A Galaxy Simulator based on the density wave theory
-# (c) 2012 Ingo Berg
-#
-# Simulating a Galaxy with the density wave theory
-# http://beltoforion.de/galaxy/galaxy_en.html
-#
-# Python version(c) 2014 Nicolas P.Rougier
-# -----------------------------------------------------------------------------
-import math
-import numpy as np
-
-
-class Galaxy(object):
- """ Galaxy simulation using the density wave theory """
-
- def __init__(self, n=20000):
- """ Initialize galaxy """
-
- # Excentricity of the innermost ellipse
- self._inner_excentricity = 0.8
-
- # Excentricity of the outermost ellipse
- self._outer_excentricity = 1.0
-
- # Velovity at the innermost core in km/s
- self._center_velocity = 30
-
- # Velocity at the core edge in km/s
- self._inner_velocity = 200
-
- # Velocity at the edge of the disk in km/s
- self._outer_velocity = 300
-
- # Angular offset per parsec
- self._angular_offset = 0.019
-
- # Inner core radius
- self._core_radius = 6000
-
- # Galaxy radius
- self._galaxy_radius = 15000
-
- # The radius after which all density waves must have circular shape
- self._distant_radius = 0
-
- # Distribution of stars
- self._star_distribution = 0.45
-
- # Angular velocity of the density waves
- self._angular_velocity = 0.000001
-
- # Number of stars
- self._stars_count = n
-
- # Number of dust particles
- self._dust_count = int(self._stars_count * 0.75)
-
- # Number of H-II regions
- self._h2_count = 200
-
- # Particles
- dtype = [('theta', np.float32, 1),
- ('velocity', np.float32, 1),
- ('angle', np.float32, 1),
- ('m_a', np.float32, 1),
- ('m_b', np.float32, 1),
- ('size', np.float32, 1),
- ('type', np.float32, 1),
- ('temperature', np.float32, 1),
- ('brightness', np.float32, 1),
- ('position', np.float32, 2)]
- n = self._stars_count + self._dust_count + 2*self._h2_count
- self._particles = np.zeros(n, dtype=dtype)
-
- i0 = 0
- i1 = i0 + self._stars_count
- self._stars = self._particles[i0:i1]
- self._stars['size'] = 3.
- self._stars['type'] = 0
-
- i0 = i1
- i1 = i0 + self._dust_count
- self._dust = self._particles[i0:i1]
- self._dust['size'] = 64
- self._dust['type'] = 1
-
- i0 = i1
- i1 = i0 + self._h2_count
- self._h2a = self._particles[i0:i1]
- self._h2a['size'] = 0
- self._h2a['type'] = 2
-
- i0 = i1
- i1 = i0 + self._h2_count
- self._h2b = self._particles[i0:i1]
- self._h2b['size'] = 0
- self._h2b['type'] = 3
-
- def __len__(self):
- """ Number of particles """
-
- if self._particles is not None:
- return len(self._particles)
- return 0
-
- def __getitem__(self, key):
- """ x.__getitem__(y) <==> x[y] """
-
- if self._particles is not None:
- return self._particles[key]
- return None
-
- def reset(self, rad, radCore, deltaAng,
- ex1, ex2, sigma, velInner, velOuter):
-
- # Initialize parameters
- # ---------------------
- self._inner_excentricity = ex1
- self._outer_excentricity = ex2
- self._inner_velocity = velInner
- self._outer_velocity = velOuter
- self._angular_offset = deltaAng
- self._core_radius = radCore
- self._galaxy_radius = rad
- self._distant_radius = self._galaxy_radius * 2
- self.m_sigma = sigma
-
- # Initialize stars
- # ----------------
- stars = self._stars
- R = np.random.normal(0, sigma, len(stars)) * self._galaxy_radius
- stars['m_a'] = R
- stars['angle'] = 90 - R * self._angular_offset
- stars['theta'] = np.random.uniform(0, 360, len(stars))
- stars['temperature'] = np.random.uniform(3000, 9000, len(stars))
- stars['brightness'] = np.random.uniform(0.05, 0.25, len(stars))
- stars['velocity'] = 0.000005
-
- for i in range(len(stars)):
- stars['m_b'][i] = R[i] * self.excentricity(R[i])
-
- # Initialize dust
- # ---------------
- dust = self._dust
- X = np.random.uniform(0, 2*self._galaxy_radius, len(dust))
- Y = np.random.uniform(-self._galaxy_radius, self._galaxy_radius,
- len(dust))
- R = np.sqrt(X*X+Y*Y)
- dust['m_a'] = R
- dust['angle'] = R * self._angular_offset
- dust['theta'] = np.random.uniform(0, 360, len(dust))
- dust['velocity'] = 0.000005
- dust['temperature'] = 6000 + R/4
- dust['brightness'] = np.random.uniform(0.01, 0.02)
- for i in range(len(dust)):
- dust['m_b'][i] = R[i] * self.excentricity(R[i])
-
- # Initialise H-II
- # ---------------
- h2a, h2b = self._h2a, self._h2b
- X = np.random.uniform(-self._galaxy_radius, self._galaxy_radius,
- len(h2a))
- Y = np.random.uniform(-self._galaxy_radius, self._galaxy_radius,
- len(h2a))
- R = np.sqrt(X*X+Y*Y)
-
- h2a['m_a'] = R
- h2b['m_a'] = R + 1000
-
- h2a['angle'] = R * self._angular_offset
- h2b['angle'] = h2a['angle']
-
- h2a['theta'] = np.random.uniform(0, 360, len(h2a))
- h2b['theta'] = h2a['theta']
-
- h2a['velocity'] = 0.000005
- h2b['velocity'] = 0.000005
-
- h2a['temperature'] = np.random.uniform(3000, 9000, len(h2a))
- h2b['temperature'] = h2a['temperature']
-
- h2a['brightness'] = np.random.uniform(0.005, 0.010, len(h2a))
- h2b['brightness'] = h2a['brightness']
-
- for i in range(len(h2a)):
- h2a['m_b'][i] = R[i] * self.excentricity(R[i])
- h2b['m_b'] = h2a['m_b']
-
- def update(self, timestep=100000):
- """ Update simulation """
-
- self._particles['theta'] += self._particles['velocity'] * timestep
-
- P = self._particles
- a, b = P['m_a'], P['m_b']
- theta, beta = P['theta'], -P['angle']
-
- alpha = theta * math.pi / 180.0
- cos_alpha = np.cos(alpha)
- sin_alpha = np.sin(alpha)
- cos_beta = np.cos(beta)
- sin_beta = np.sin(beta)
- P['position'][:, 0] = a*cos_alpha*cos_beta - b*sin_alpha*sin_beta
- P['position'][:, 1] = a*cos_alpha*sin_beta + b*sin_alpha*cos_beta
-
- D = np.sqrt(((self._h2a['position'] -
- self._h2b['position'])**2).sum(axis=1))
- S = np.maximum(1, ((1000-D)/10) - 50)
- self._h2a['size'] = 2.0*S
- self._h2b['size'] = S/6.0
-
- def excentricity(self, r):
-
- # Core region of the galaxy. Innermost part is round
- # excentricity increasing linear to the border of the core.
- if r < self._core_radius:
- return 1 + (r / self._core_radius) * (self._inner_excentricity-1)
-
- elif r > self._core_radius and r <= self._galaxy_radius:
- a = self._galaxy_radius - self._core_radius
- b = self._outer_excentricity - self._inner_excentricity
- return self._inner_excentricity + (r - self._core_radius) / a * b
-
- # Excentricity is slowly reduced to 1.
- elif r > self._galaxy_radius and r < self._distant_radius:
- a = self._distant_radius - self._galaxy_radius
- b = 1 - self._outer_excentricity
- return self._outer_excentricity + (r - self._galaxy_radius) / a * b
-
- else:
- return 1
diff --git a/examples/demo/gloo/galaxy/galaxy_specrend.py b/examples/demo/gloo/galaxy/galaxy_specrend.py
deleted file mode 100644
index b042fc5..0000000
--- a/examples/demo/gloo/galaxy/galaxy_specrend.py
+++ /dev/null
@@ -1,422 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-
-"""
-Colour Rendering of Spectra
-
-by John Walker
-http://www.fourmilab.ch/
-
-Last updated: March 9, 2003
-
-Converted to Python by Andrew Hutchins, sometime in early
-2011.
-
- This program is in the public domain.
- The modifications are also public domain. (AH)
-
-For complete information about the techniques employed in
-this program, see the World-Wide Web document:
-
- http://www.fourmilab.ch/documents/specrend/
-
-The xyz_to_rgb() function, which was wrong in the original
-version of this program, was corrected by:
-
- Andrew J. S. Hamilton 21 May 1999
- Andrew.Hamilton at Colorado.EDU
- http://casa.colorado.edu/~ajsh/
-
-who also added the gamma correction facilities and
-modified constrain_rgb() to work by desaturating the
-colour by adding white.
-
-A program which uses these functions to plot CIE
-"tongue" diagrams called "ppmcie" is included in
-the Netpbm graphics toolkit:
-
- http://netpbm.sourceforge.net/
-
-(The program was called cietoppm in earlier
-versions of Netpbm.)
-
-"""
-import math
-
-# A colour system is defined by the CIE x and y coordinates of
-# its three primary illuminants and the x and y coordinates of
-# the white point.
-
-GAMMA_REC709 = 0
-
-NTSCsystem = {"name": "NTSC",
- "xRed": 0.67, "yRed": 0.33,
- "xGreen": 0.21, "yGreen": 0.71,
- "xBlue": 0.14, "yBlue": 0.08,
- "xWhite": 0.3101, "yWhite": 0.3163, "gamma": GAMMA_REC709}
-
-EBUsystem = {"name": "SUBU (PAL/SECAM)",
- "xRed": 0.64, "yRed": 0.33,
- "xGreen": 0.29, "yGreen": 0.60,
- "xBlue": 0.15, "yBlue": 0.06,
- "xWhite": 0.3127, "yWhite": 0.3291, "gamma": GAMMA_REC709}
-SMPTEsystem = {"name": "SMPTE",
- "xRed": 0.63, "yRed": 0.34,
- "xGreen": 0.31, "yGreen": 0.595,
- "xBlue": 0.155, "yBlue": 0.07,
- "xWhite": 0.3127, "yWhite": 0.3291, "gamma": GAMMA_REC709}
-
-HDTVsystem = {"name": "HDTV",
- "xRed": 0.67, "yRed": 0.33,
- "xGreen": 0.21, "yGreen": 0.71,
- "xBlue": 0.15, "yBlue": 0.06,
- "xWhite": 0.3127, "yWhite": 0.3291, "gamma": GAMMA_REC709}
-
-CIEsystem = {"name": "CIE",
- "xRed": 0.7355, "yRed": 0.2645,
- "xGreen": 0.2658, "yGreen": 0.7243,
- "xBlue": 0.1669, "yBlue": 0.0085,
- "xWhite": 0.3333333333, "yWhite": 0.3333333333,
- "gamma": GAMMA_REC709}
-
-Rec709system = {"name": "CIE REC709",
- "xRed": 0.64, "yRed": 0.33,
- "xGreen": 0.30, "yGreen": 0.60,
- "xBlue": 0.15, "yBlue": 0.06,
- "xWhite": 0.3127, "yWhite": 0.3291,
- "gamma": GAMMA_REC709}
-
-
-def upvp_to_xy(up, vp):
- xc = (9 * up) / ((6 * up) - (16 * vp) + 12)
- yc = (4 * vp) / ((6 * up) - (16 * vp) + 12)
- return(xc, yc)
-
-
-def xy_toupvp(xc, yc):
- up = (4 * xc) / ((-2 * xc) + (12 * yc) + 3)
- vp = (9 * yc) / ((-2 * xc) + (12 * yc) + 3)
- return(up, vp)
-
-
-def xyz_to_rgb(cs, xc, yc, zc):
- """
- Given an additive tricolour system CS, defined by the CIE x
- and y chromaticities of its three primaries (z is derived
- trivially as 1-(x+y)), and a desired chromaticity (XC, YC,
- ZC) in CIE space, determine the contribution of each
- primary in a linear combination which sums to the desired
- chromaticity. If the requested chromaticity falls outside
- the Maxwell triangle (colour gamut) formed by the three
- primaries, one of the r, g, or b weights will be negative.
-
- Caller can use constrain_rgb() to desaturate an
- outside-gamut colour to the closest representation within
- the available gamut and/or norm_rgb to normalise the RGB
- components so the largest nonzero component has value 1.
- """
-
- xr = cs["xRed"]
- yr = cs["yRed"]
- zr = 1 - (xr + yr)
- xg = cs["xGreen"]
- yg = cs["yGreen"]
- zg = 1 - (xg + yg)
- xb = cs["xBlue"]
- yb = cs["yBlue"]
- zb = 1 - (xb + yb)
- xw = cs["xWhite"]
- yw = cs["yWhite"]
- zw = 1 - (xw + yw)
-
- rx = (yg * zb) - (yb * zg)
- ry = (xb * zg) - (xg * zb)
- rz = (xg * yb) - (xb * yg)
- gx = (yb * zr) - (yr * zb)
- gy = (xr * zb) - (xb * zr)
- gz = (xb * yr) - (xr * yb)
- bx = (yr * zg) - (yg * zr)
- by = (xg * zr) - (xr * zg)
- bz = (xr * yg) - (xg * yr)
-
- rw = ((rx * xw) + (ry * yw) + (rz * zw)) / yw
- gw = ((gx * xw) + (gy * yw) + (gz * zw)) / yw
- bw = ((bx * xw) + (by * yw) + (bz * zw)) / yw
-
- rx = rx / rw
- ry = ry / rw
- rz = rz / rw
- gx = gx / gw
- gy = gy / gw
- gz = gz / gw
- bx = bx / bw
- by = by / bw
- bz = bz / bw
-
- r = (rx * xc) + (ry * yc) + (rz * zc)
- g = (gx * xc) + (gy * yc) + (gz * zc)
- b = (bx * xc) + (by * yc) + (bz * zc)
-
- return(r, g, b)
-
-
-def inside_gamut(r, g, b):
- """
- Test whether a requested colour is within the gamut
- achievable with the primaries of the current colour
- system. This amounts simply to testing whether all the
- primary weights are non-negative. */
- """
- return (r >= 0) and (g >= 0) and (b >= 0)
-
-
-def constrain_rgb(r, g, b):
- """
- If the requested RGB shade contains a negative weight for
- one of the primaries, it lies outside the colour gamut
- accessible from the given triple of primaries. Desaturate
- it by adding white, equal quantities of R, G, and B, enough
- to make RGB all positive. The function returns 1 if the
- components were modified, zero otherwise.
- """
- # Amount of white needed is w = - min(0, *r, *g, *b)
- w = -min([0, r, g, b]) # I think?
-
- # Add just enough white to make r, g, b all positive.
- if w > 0:
- r += w
- g += w
- b += w
- return(r, g, b)
-
-
-def gamma_correct(cs, c):
- """
- Transform linear RGB values to nonlinear RGB values. Rec.
- 709 is ITU-R Recommendation BT. 709 (1990) ``Basic
- Parameter Values for the HDTV Standard for the Studio and
- for International Programme Exchange'', formerly CCIR Rec.
- 709. For details see
-
- http://www.poynton.com/ColorFAQ.html
- http://www.poynton.com/GammaFAQ.html
- """
- gamma = cs.gamma
-
- if gamma == GAMMA_REC709:
- cc = 0.018
- if c < cc:
- c = ((1.099 * math.pow(cc, 0.45)) - 0.099) / cc
- else:
- c = (1.099 * math.pow(c, 0.45)) - 0.099
- else:
- c = math.pow(c, 1.0 / gamma)
- return(c)
-
-
-def gamma_correct_rgb(cs, r, g, b):
- r = gamma_correct(cs, r)
- g = gamma_correct(cs, g)
- b = gamma_correct(cs, b)
- return (r, g, b)
-
-
-def norm_rgb(r, g, b):
- """
- Normalise RGB components so the most intense (unless all
- are zero) has a value of 1.
- """
- greatest = max([r, g, b])
-
- if greatest > 0:
- r /= greatest
- g /= greatest
- b /= greatest
- return(r, g, b)
-
-
-# spec_intens is a function
-def spectrum_to_xyz(spec_intens, temp):
- """
- Calculate the CIE X, Y, and Z coordinates corresponding to
- a light source with spectral distribution given by the
- function SPEC_INTENS, which is called with a series of
- wavelengths between 380 and 780 nm (the argument is
- expressed in meters), which returns emittance at that
- wavelength in arbitrary units. The chromaticity
- coordinates of the spectrum are returned in the x, y, and z
- arguments which respect the identity:
-
- x + y + z = 1.
-
- CIE colour matching functions xBar, yBar, and zBar for
- wavelengths from 380 through 780 nanometers, every 5
- nanometers. For a wavelength lambda in this range::
-
- cie_colour_match[(lambda - 380) / 5][0] = xBar
- cie_colour_match[(lambda - 380) / 5][1] = yBar
- cie_colour_match[(lambda - 380) / 5][2] = zBar
-
- AH Note 2011: This next bit is kind of irrelevant on modern
- hardware. Unless you are desperate for speed.
- In which case don't use the Python version!
-
- To save memory, this table can be declared as floats
- rather than doubles; (IEEE) float has enough
- significant bits to represent the values. It's declared
- as a double here to avoid warnings about "conversion
- between floating-point types" from certain persnickety
- compilers.
- """
-
- cie_colour_match = [
- [0.0014, 0.0000, 0.0065],
- [0.0022, 0.0001, 0.0105],
- [0.0042, 0.0001, 0.0201],
- [0.0076, 0.0002, 0.0362],
- [0.0143, 0.0004, 0.0679],
- [0.0232, 0.0006, 0.1102],
- [0.0435, 0.0012, 0.2074],
- [0.0776, 0.0022, 0.3713],
- [0.1344, 0.0040, 0.6456],
- [0.2148, 0.0073, 1.0391],
- [0.2839, 0.0116, 1.3856],
- [0.3285, 0.0168, 1.6230],
- [0.3483, 0.0230, 1.7471],
- [0.3481, 0.0298, 1.7826],
- [0.3362, 0.0380, 1.7721],
- [0.3187, 0.0480, 1.7441],
- [0.2908, 0.0600, 1.6692],
- [0.2511, 0.0739, 1.5281],
- [0.1954, 0.0910, 1.2876],
- [0.1421, 0.1126, 1.0419],
- [0.0956, 0.1390, 0.8130],
- [0.0580, 0.1693, 0.6162],
- [0.0320, 0.2080, 0.4652],
- [0.0147, 0.2586, 0.3533],
- [0.0049, 0.3230, 0.2720],
- [0.0024, 0.4073, 0.2123],
- [0.0093, 0.5030, 0.1582],
- [0.0291, 0.6082, 0.1117],
- [0.0633, 0.7100, 0.0782],
- [0.1096, 0.7932, 0.0573],
- [0.1655, 0.8620, 0.0422],
- [0.2257, 0.9149, 0.0298],
- [0.2904, 0.9540, 0.0203],
- [0.3597, 0.9803, 0.0134],
- [0.4334, 0.9950, 0.0087],
- [0.5121, 1.0000, 0.0057],
- [0.5945, 0.9950, 0.0039],
- [0.6784, 0.9786, 0.0027],
- [0.7621, 0.9520, 0.0021],
- [0.8425, 0.9154, 0.0018],
- [0.9163, 0.8700, 0.0017],
- [0.9786, 0.8163, 0.0014],
- [1.0263, 0.7570, 0.0011],
- [1.0567, 0.6949, 0.0010],
- [1.0622, 0.6310, 0.0008],
- [1.0456, 0.5668, 0.0006],
- [1.0026, 0.5030, 0.0003],
- [0.9384, 0.4412, 0.0002],
- [0.8544, 0.3810, 0.0002],
- [0.7514, 0.3210, 0.0001],
- [0.6424, 0.2650, 0.0000],
- [0.5419, 0.2170, 0.0000],
- [0.4479, 0.1750, 0.0000],
- [0.3608, 0.1382, 0.0000],
- [0.2835, 0.1070, 0.0000],
- [0.2187, 0.0816, 0.0000],
- [0.1649, 0.0610, 0.0000],
- [0.1212, 0.0446, 0.0000],
- [0.0874, 0.0320, 0.0000],
- [0.0636, 0.0232, 0.0000],
- [0.0468, 0.0170, 0.0000],
- [0.0329, 0.0119, 0.0000],
- [0.0227, 0.0082, 0.0000],
- [0.0158, 0.0057, 0.0000],
- [0.0114, 0.0041, 0.0000],
- [0.0081, 0.0029, 0.0000],
- [0.0058, 0.0021, 0.0000],
- [0.0041, 0.0015, 0.0000],
- [0.0029, 0.0010, 0.0000],
- [0.0020, 0.0007, 0.0000],
- [0.0014, 0.0005, 0.0000],
- [0.0010, 0.0004, 0.0000],
- [0.0007, 0.0002, 0.0000],
- [0.0005, 0.0002, 0.0000],
- [0.0003, 0.0001, 0.0000],
- [0.0002, 0.0001, 0.0000],
- [0.0002, 0.0001, 0.0000],
- [0.0001, 0.0000, 0.0000],
- [0.0001, 0.0000, 0.0000],
- [0.0001, 0.0000, 0.0000],
- [0.0000, 0.0000, 0.0000]]
-
- X = 0
- Y = 0
- Z = 0
- # lambda = 380; lambda < 780.1; i++, lambda += 5) {
- for i, lamb in enumerate(range(380, 780, 5)):
- Me = spec_intens(lamb, temp)
- X += Me * cie_colour_match[i][0]
- Y += Me * cie_colour_match[i][1]
- Z += Me * cie_colour_match[i][2]
- XYZ = (X + Y + Z)
- x = X / XYZ
- y = Y / XYZ
- z = Z / XYZ
-
- return(x, y, z)
-
-
-def bb_spectrum(wavelength, bbTemp=5000):
- """
- Calculate, by Planck's radiation law, the emittance of a black body
- of temperature bbTemp at the given wavelength (in metres). */
- """
- wlm = wavelength * 1e-9 # Convert to metres
- return (3.74183e-16 *
- math.pow(wlm, -5.0)) / (math.exp(1.4388e-2 / (wlm * bbTemp)) - 1.0)
-
- """ Built-in test program which displays the x, y, and Z and RGB
- values for black body spectra from 1000 to 10000 degrees kelvin.
- When run, this program should produce the following output:
-
- Temperature x y z R G B
- ----------- ------ ------ ------ ----- ----- -----
- 1000 K 0.6528 0.3444 0.0028 1.000 0.007 0.000 (Approximation)
- 1500 K 0.5857 0.3931 0.0212 1.000 0.126 0.000 (Approximation)
- 2000 K 0.5267 0.4133 0.0600 1.000 0.234 0.010
- 2500 K 0.4770 0.4137 0.1093 1.000 0.349 0.067
- 3000 K 0.4369 0.4041 0.1590 1.000 0.454 0.151
- 3500 K 0.4053 0.3907 0.2040 1.000 0.549 0.254
- 4000 K 0.3805 0.3768 0.2428 1.000 0.635 0.370
- 4500 K 0.3608 0.3636 0.2756 1.000 0.710 0.493
- 5000 K 0.3451 0.3516 0.3032 1.000 0.778 0.620
- 5500 K 0.3325 0.3411 0.3265 1.000 0.837 0.746
- 6000 K 0.3221 0.3318 0.3461 1.000 0.890 0.869
- 6500 K 0.3135 0.3237 0.3628 1.000 0.937 0.988
- 7000 K 0.3064 0.3166 0.3770 0.907 0.888 1.000
- 7500 K 0.3004 0.3103 0.3893 0.827 0.839 1.000
- 8000 K 0.2952 0.3048 0.4000 0.762 0.800 1.000
- 8500 K 0.2908 0.3000 0.4093 0.711 0.766 1.000
- 9000 K 0.2869 0.2956 0.4174 0.668 0.738 1.000
- 9500 K 0.2836 0.2918 0.4246 0.632 0.714 1.000
- 10000 K 0.2807 0.2884 0.4310 0.602 0.693 1.000
-"""
-
-if __name__ == "__main__":
- print("Temperature x y z R G B\n")
- print("----------- ------ ------ ------ ----- ----- -----\n")
-
- for t in range(1000, 10000, 500): # (t = 1000; t <= 10000; t+= 500) {
- x, y, z = spectrum_to_xyz(bb_spectrum, t)
-
- r, g, b = xyz_to_rgb(SMPTEsystem, x, y, z)
-
- print(" %5.0f K %.4f %.4f %.4f " % (t, x, y, z))
-
- # I omit the approximation bit here.
- r, g, b = constrain_rgb(r, g, b)
- r, g, b = norm_rgb(r, g, b)
- print("%.3f %.3f %.3f" % (r, g, b))
diff --git a/examples/demo/gloo/game_of_life.py b/examples/demo/gloo/game_of_life.py
deleted file mode 100644
index ed72e18..0000000
--- a/examples/demo/gloo/game_of_life.py
+++ /dev/null
@@ -1,180 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 200
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 06/03/2014
-# Abstract: GPU computing using the framebuffer
-# Keywords: framebuffer, GPU computing, cellular automata
-# -----------------------------------------------------------------------------
-"""
-Conway game of life.
-"""
-
-import numpy as np
-from vispy.gloo import (Program, FrameBuffer, RenderBuffer,
- clear, set_viewport, set_state)
-from vispy import app
-
-
-render_vertex = """
-attribute vec2 position;
-attribute vec2 texcoord;
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0);
- v_texcoord = texcoord;
-}
-"""
-
-render_fragment = """
-uniform int pingpong;
-uniform sampler2D texture;
-varying vec2 v_texcoord;
-void main()
-{
- float v;
- v = texture2D(texture, v_texcoord)[pingpong];
- gl_FragColor = vec4(1.0-v, 1.0-v, 1.0-v, 1.0);
-}
-"""
-
-compute_vertex = """
-attribute vec2 position;
-attribute vec2 texcoord;
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0);
- v_texcoord = texcoord;
-}
-"""
-
-compute_fragment = """
-uniform int pingpong;
-uniform sampler2D texture;
-uniform float dx; // horizontal distance between texels
-uniform float dy; // vertical distance between texels
-varying vec2 v_texcoord;
-void main(void)
-{
- vec2 p = v_texcoord;
- float old_state, new_state, count;
-
- old_state = texture2D(texture, p)[pingpong];
- count = texture2D(texture, p + vec2(-dx,-dy))[pingpong]
- + texture2D(texture, p + vec2( dx,-dy))[pingpong]
- + texture2D(texture, p + vec2(-dx, dy))[pingpong]
- + texture2D(texture, p + vec2( dx, dy))[pingpong]
- + texture2D(texture, p + vec2(-dx, 0.0))[pingpong]
- + texture2D(texture, p + vec2( dx, 0.0))[pingpong]
- + texture2D(texture, p + vec2(0.0,-dy))[pingpong]
- + texture2D(texture, p + vec2(0.0, dy))[pingpong];
-
- new_state = old_state;
- if( old_state > 0.5 ) {
- // Any live cell with fewer than two live neighbours dies
- // as if caused by under-population.
- if( count < 1.5 )
- new_state = 0.0;
-
- // Any live cell with two or three live neighbours
- // lives on to the next generation.
-
- // Any live cell with more than three live neighbours dies,
- // as if by overcrowding.
- else if( count > 3.5 )
- new_state = 0.0;
- } else {
- // Any dead cell with exactly three live neighbours becomes
- // a live cell, as if by reproduction.
- if( (count > 2.5) && (count < 3.5) )
- new_state = 1.0;
- }
-
- if( pingpong == 0) {
- gl_FragColor[1] = new_state;
- gl_FragColor[0] = old_state;
- } else {
- gl_FragColor[1] = old_state;
- gl_FragColor[0] = new_state;
- }
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, title="Conway game of life",
- size=(512, 512), keys='interactive')
-
- # Build programs
- # --------------
- self.comp_size = self.size
- size = self.comp_size + (4,)
- Z = np.zeros(size, dtype=np.float32)
- Z[...] = np.random.randint(0, 2, size)
- Z[:256, :256, :] = 0
- gun = """
- ........................O...........
- ......................O.O...........
- ............OO......OO............OO
- ...........O...O....OO............OO
- OO........O.....O...OO..............
- OO........O...O.OO....O.O...........
- ..........O.....O.......O...........
- ...........O...O....................
- ............OO......................"""
- x, y = 0, 0
- for i in range(len(gun)):
- if gun[i] == '\n':
- y += 1
- x = 0
- elif gun[i] == 'O':
- Z[y, x] = 1
- x += 1
-
- self.pingpong = 1
- self.compute = Program(compute_vertex, compute_fragment, 4)
- self.compute["texture"] = Z
- self.compute["position"] = [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
- self.compute["texcoord"] = [(0, 0), (0, 1), (1, 0), (1, 1)]
- self.compute['dx'] = 1.0 / size[1]
- self.compute['dy'] = 1.0 / size[0]
- self.compute['pingpong'] = self.pingpong
-
- self.render = Program(render_vertex, render_fragment, 4)
- self.render["position"] = [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
- self.render["texcoord"] = [(0, 0), (0, 1), (1, 0), (1, 1)]
- self.render["texture"] = self.compute["texture"]
- self.render['pingpong'] = self.pingpong
-
- self.fbo = FrameBuffer(self.compute["texture"],
- RenderBuffer(self.comp_size))
- set_state(depth_test=False, clear_color='black')
-
- self._timer = app.Timer('auto', connect=self.update, start=True)
-
- self.show()
-
- def on_draw(self, event):
- with self.fbo:
- set_viewport(0, 0, *self.comp_size)
- self.compute["texture"].interpolation = 'nearest'
- self.compute.draw('triangle_strip')
- clear()
- set_viewport(0, 0, *self.physical_size)
- self.render["texture"].interpolation = 'linear'
- self.render.draw('triangle_strip')
- self.pingpong = 1 - self.pingpong
- self.compute["pingpong"] = self.pingpong
- self.render["pingpong"] = self.pingpong
-
-
-if __name__ == '__main__':
- canvas = Canvas()
- app.run()
diff --git a/examples/demo/gloo/glsl_sandbox_cube.py b/examples/demo/gloo/glsl_sandbox_cube.py
deleted file mode 100644
index d602faf..0000000
--- a/examples/demo/gloo/glsl_sandbox_cube.py
+++ /dev/null
@@ -1,180 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""
-A GLSL sandbox application based on the spinning cube. Requires PySide
-or PyQt4.
-"""
-
-import numpy as np
-from vispy import app, gloo
-from vispy.io import read_mesh, load_data_file, load_crate
-from vispy.util.transforms import perspective, translate, rotate
-
-# Force using qt and take QtCore+QtGui from backend module
-try:
- app_object = app.use_app('pyqt4')
-except Exception:
- app_object = app.use_app('pyside')
-QtCore = app_object.backend_module.QtCore,
-QtGui = app_object.backend_module.QtGui
-
-
-VERT_CODE = """
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-
-attribute vec3 a_position;
-attribute vec2 a_texcoord;
-
-varying vec2 v_texcoord;
-
-void main()
-{
- v_texcoord = a_texcoord;
- gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);
- //gl_Position = vec4(a_position,1.0);
-}
-"""
-
-
-FRAG_CODE = """
-uniform sampler2D u_texture;
-varying vec2 v_texcoord;
-
-void main()
-{
- float ty = v_texcoord.y;
- float tx = sin(ty*50.0)*0.01 + v_texcoord.x;
- gl_FragColor = texture2D(u_texture, vec2(tx, ty));
-}
-"""
-
-
-# Read cube data
-positions, faces, normals, texcoords = \
- read_mesh(load_data_file('orig/cube.obj'))
-colors = np.random.uniform(0, 1, positions.shape).astype('float32')
-
-faces_buffer = gloo.IndexBuffer(faces.astype(np.uint16))
-
-
-class Canvas(app.Canvas):
-
- def __init__(self, **kwargs):
- app.Canvas.__init__(self, size=(400, 400), **kwargs)
-
- self.program = gloo.Program(VERT_CODE, FRAG_CODE)
-
- # Set attributes
- self.program['a_position'] = gloo.VertexBuffer(positions)
- self.program['a_texcoord'] = gloo.VertexBuffer(texcoords)
-
- self.program['u_texture'] = gloo.Texture2D(load_crate())
-
- # Handle transformations
- self.init_transforms()
-
- self.apply_zoom()
-
- gloo.set_clear_color((1, 1, 1, 1))
- gloo.set_state(depth_test=True)
-
- self._timer = app.Timer('auto', connect=self.update_transforms)
- self._timer.start()
-
- self.show()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('triangles', faces_buffer)
-
- def init_transforms(self):
- self.theta = 0
- self.phi = 0
- self.view = translate((0, 0, -5))
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
-
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
-
- def update_transforms(self, event):
- self.theta += .5
- self.phi += .5
- self.model = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.program['u_model'] = self.model
- self.update()
-
- def apply_zoom(self):
- gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])
- self.projection = perspective(45.0, self.size[0] /
- float(self.size[1]), 2.0, 10.0)
- self.program['u_projection'] = self.projection
-
-
-class TextField(QtGui.QPlainTextEdit):
-
- def __init__(self, parent):
- QtGui.QPlainTextEdit.__init__(self, parent)
- # Set font to monospaced (TypeWriter)
- font = QtGui.QFont('')
- font.setStyleHint(font.TypeWriter, font.PreferDefault)
- font.setPointSize(8)
- self.setFont(font)
-
-
-class MainWindow(QtGui.QWidget):
-
- def __init__(self):
- QtGui.QWidget.__init__(self, None)
-
- self.setMinimumSize(600, 400)
-
- # Create two labels and a button
- self.vertLabel = QtGui.QLabel("Vertex code", self)
- self.fragLabel = QtGui.QLabel("Fragment code", self)
- self.theButton = QtGui.QPushButton("Compile!", self)
- self.theButton.clicked.connect(self.on_compile)
-
- # Create two editors
- self.vertEdit = TextField(self)
- self.vertEdit.setPlainText(VERT_CODE)
- self.fragEdit = TextField(self)
- self.fragEdit.setPlainText(FRAG_CODE)
-
- # Create a canvas
- self.canvas = Canvas(parent=self)
-
- # Layout
- hlayout = QtGui.QHBoxLayout(self)
- self.setLayout(hlayout)
- vlayout = QtGui.QVBoxLayout()
- #
- hlayout.addLayout(vlayout, 1)
- hlayout.addWidget(self.canvas.native, 1)
- #
- vlayout.addWidget(self.vertLabel, 0)
- vlayout.addWidget(self.vertEdit, 1)
- vlayout.addWidget(self.fragLabel, 0)
- vlayout.addWidget(self.fragEdit, 1)
- vlayout.addWidget(self.theButton, 0)
-
- self.show()
-
- def on_compile(self):
- vert_code = str(self.vertEdit.toPlainText())
- frag_code = str(self.fragEdit.toPlainText())
- self.canvas.program.set_shaders(vert_code, frag_code)
- # Note how we do not need to reset our variables, they are
- # re-set automatically (by gloo)
-
-
-if __name__ == '__main__':
- app.create()
- m = MainWindow()
- app.run()
diff --git a/examples/demo/gloo/graph.py b/examples/demo/gloo/graph.py
deleted file mode 100644
index 9d9f405..0000000
--- a/examples/demo/gloo/graph.py
+++ /dev/null
@@ -1,190 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 60
-
-"""
-Dynamic planar graph layout.
-"""
-
-import numpy as np
-from vispy import gloo, app
-from vispy.gloo import set_viewport, set_state, clear
-
-vert = """
-#version 120
-
-// Uniforms
-// ------------------------------------
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform float u_antialias;
-uniform float u_size;
-
-// Attributes
-// ------------------------------------
-attribute vec3 a_position;
-attribute vec4 a_fg_color;
-attribute vec4 a_bg_color;
-attribute float a_linewidth;
-attribute float a_size;
-
-// Varyings
-// ------------------------------------
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_size;
-varying float v_linewidth;
-varying float v_antialias;
-
-void main (void) {
- v_size = a_size * u_size;
- v_linewidth = a_linewidth;
- v_antialias = u_antialias;
- v_fg_color = a_fg_color;
- v_bg_color = a_bg_color;
- gl_Position = u_projection * u_view * u_model *
- vec4(a_position*u_size,1.0);
- gl_PointSize = v_size + 2*(v_linewidth + 1.5*v_antialias);
-}
-"""
-
-frag = """
-#version 120
-
-// Constants
-// ------------------------------------
-
-// Varyings
-// ------------------------------------
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_size;
-varying float v_linewidth;
-varying float v_antialias;
-
-// Functions
-// ------------------------------------
-float marker(vec2 P, float size);
-
-
-// Main
-// ------------------------------------
-void main()
-{
- float size = v_size +2*(v_linewidth + 1.5*v_antialias);
- float t = v_linewidth/2.0-v_antialias;
-
- // The marker function needs to be linked with this shader
- float r = marker(gl_PointCoord, size);
-
- float d = abs(r) - t;
- if( r > (v_linewidth/2.0+v_antialias))
- {
- discard;
- }
- else if( d < 0.0 )
- {
- gl_FragColor = v_fg_color;
- }
- else
- {
- float alpha = d/v_antialias;
- alpha = exp(-alpha*alpha);
- if (r > 0)
- gl_FragColor = vec4(v_fg_color.rgb, alpha*v_fg_color.a);
- else
- gl_FragColor = mix(v_bg_color, v_fg_color, alpha);
- }
-}
-
-float marker(vec2 P, float size)
-{
- float r = length((P.xy - vec2(0.5,0.5))*size);
- r -= v_size/2;
- return r;
-}
-"""
-
-vs = """
-attribute vec3 a_position;
-attribute vec4 a_fg_color;
-attribute vec4 a_bg_color;
-attribute float a_size;
-attribute float a_linewidth;
-
-void main(){
- gl_Position = vec4(a_position, 1.);
-}
-"""
-
-fs = """
-void main(){
- gl_FragColor = vec4(0., 0., 0., 1.);
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self, **kwargs):
- # Initialize the canvas for real
- app.Canvas.__init__(self, keys='interactive', size=(512, 512),
- **kwargs)
- ps = self.pixel_scale
- self.position = 50, 50
-
- n = 100
- ne = 100
- data = np.zeros(n, dtype=[('a_position', np.float32, 3),
- ('a_fg_color', np.float32, 4),
- ('a_bg_color', np.float32, 4),
- ('a_size', np.float32, 1),
- ('a_linewidth', np.float32, 1),
- ])
- edges = np.random.randint(size=(ne, 2), low=0,
- high=n).astype(np.uint32)
- data['a_position'] = np.hstack((.25 * np.random.randn(n, 2),
- np.zeros((n, 1))))
- data['a_fg_color'] = 0, 0, 0, 1
- color = np.random.uniform(0.5, 1., (n, 3))
- data['a_bg_color'] = np.hstack((color, np.ones((n, 1))))
- data['a_size'] = np.random.randint(size=n, low=8*ps, high=20*ps)
- data['a_linewidth'] = 1.*ps
- u_antialias = 1
-
- self.vbo = gloo.VertexBuffer(data)
- self.index = gloo.IndexBuffer(edges)
- self.view = np.eye(4, dtype=np.float32)
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
-
- self.program = gloo.Program(vert, frag)
- self.program.bind(self.vbo)
- self.program['u_size'] = 1
- self.program['u_antialias'] = u_antialias
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
- self.program['u_projection'] = self.projection
-
- set_viewport(0, 0, *self.physical_size)
-
- self.program_e = gloo.Program(vs, fs)
- self.program_e.bind(self.vbo)
-
- set_state(clear_color='white', depth_test=False, blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- self.show()
-
- def on_resize(self, event):
- set_viewport(0, 0, *event.physical_size)
-
- def on_draw(self, event):
- clear(color=True, depth=True)
- self.program_e.draw('lines', self.index)
- self.program.draw('points')
-
-if __name__ == '__main__':
- c = Canvas(title="Graph")
- app.run()
diff --git a/examples/demo/gloo/grayscott.py b/examples/demo/gloo/grayscott.py
deleted file mode 100644
index 05980a5..0000000
--- a/examples/demo/gloo/grayscott.py
+++ /dev/null
@@ -1,208 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 2000
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 06/03/2014
-# Abstract: GPU computing usingthe framebuffer
-# Keywords: framebuffer, GPU computing, reaction-diffusion
-# -----------------------------------------------------------------------------
-
-import numpy as np
-from vispy.gloo import (Program, FrameBuffer, RenderBuffer, set_viewport,
- clear, set_state)
-from vispy import app
-
-
-render_vertex = """
-attribute vec2 position;
-attribute vec2 texcoord;
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0);
- v_texcoord = texcoord;
-}
-"""
-
-render_fragment = """
-uniform int pingpong;
-uniform sampler2D texture;
-varying vec2 v_texcoord;
-void main()
-{
- float v;
- if( pingpong == 0 )
- v = texture2D(texture, v_texcoord).r;
- else
- v = texture2D(texture, v_texcoord).b;
- gl_FragColor = vec4(1.0-v, 1.0-v, 1.0-v, 1.0);
-}
-"""
-
-compute_vertex = """
-attribute vec2 position;
-attribute vec2 texcoord;
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0);
- v_texcoord = texcoord;
-}
-"""
-
-compute_fragment = """
-uniform int pingpong;
-uniform sampler2D texture; // U,V:= r,g, other channels ignored
-uniform sampler2D params; // rU,rV,f,k := r,g,b,a
-uniform float dx; // horizontal distance between texels
-uniform float dy; // vertical distance between texels
-uniform float dd; // unit of distance
-uniform float dt; // unit of time
-varying vec2 v_texcoord;
-void main(void)
-{
- float center = -(4.0+4.0/sqrt(2.0)); // -1 * other weights
- float diag = 1.0/sqrt(2.0); // weight for diagonals
- vec2 p = v_texcoord; // center coordinates
-
- vec2 c,l;
- if( pingpong == 0 ) {
- c = texture2D(texture, p).rg; // central value
- // Compute Laplacian
- l = ( texture2D(texture, p + vec2(-dx,-dy)).rg
- + texture2D(texture, p + vec2( dx,-dy)).rg
- + texture2D(texture, p + vec2(-dx, dy)).rg
- + texture2D(texture, p + vec2( dx, dy)).rg) * diag
- + texture2D(texture, p + vec2(-dx, 0.0)).rg
- + texture2D(texture, p + vec2( dx, 0.0)).rg
- + texture2D(texture, p + vec2(0.0,-dy)).rg
- + texture2D(texture, p + vec2(0.0, dy)).rg
- + c * center;
- } else {
- c = texture2D(texture, p).ba; // central value
- // Compute Laplacian
- l = ( texture2D(texture, p + vec2(-dx,-dy)).ba
- + texture2D(texture, p + vec2( dx,-dy)).ba
- + texture2D(texture, p + vec2(-dx, dy)).ba
- + texture2D(texture, p + vec2( dx, dy)).ba) * diag
- + texture2D(texture, p + vec2(-dx, 0.0)).ba
- + texture2D(texture, p + vec2( dx, 0.0)).ba
- + texture2D(texture, p + vec2(0.0,-dy)).ba
- + texture2D(texture, p + vec2(0.0, dy)).ba
- + c * center;
- }
-
- float u = c.r; // compute some temporary
- float v = c.g; // values which might save
- float lu = l.r; // a few GPU cycles
- float lv = l.g;
- float uvv = u * v * v;
-
- vec4 q = texture2D(params, p).rgba;
- float ru = q.r; // rate of diffusion of U
- float rv = q.g; // rate of diffusion of V
- float f = q.b; // some coupling parameter
- float k = q.a; // another coupling parameter
-
- float du = ru * lu / dd - uvv + f * (1.0 - u); // Gray-Scott equation
- float dv = rv * lv / dd + uvv - (f + k) * v; // diffusion+-reaction
-
- u += du * dt;
- v += dv * dt;
-
- if( pingpong == 1 ) {
- gl_FragColor = vec4(clamp(u, 0.0, 1.0), clamp(v, 0.0, 1.0), c);
- } else {
- gl_FragColor = vec4(c, clamp(u, 0.0, 1.0), clamp(v, 0.0, 1.0));
- }
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, title='Grayscott Reaction-Diffusion',
- size=(512, 512), keys='interactive')
-
- self.scale = 4
- self.comp_size = self.size
- comp_w, comp_h = self.comp_size
- dt = 1.0
- dd = 1.5
- species = {
- # name : [r_u, r_v, f, k]
- 'Bacteria 1': [0.16, 0.08, 0.035, 0.065],
- 'Bacteria 2': [0.14, 0.06, 0.035, 0.065],
- 'Coral': [0.16, 0.08, 0.060, 0.062],
- 'Fingerprint': [0.19, 0.05, 0.060, 0.062],
- 'Spirals': [0.10, 0.10, 0.018, 0.050],
- 'Spirals Dense': [0.12, 0.08, 0.020, 0.050],
- 'Spirals Fast': [0.10, 0.16, 0.020, 0.050],
- 'Unstable': [0.16, 0.08, 0.020, 0.055],
- 'Worms 1': [0.16, 0.08, 0.050, 0.065],
- 'Worms 2': [0.16, 0.08, 0.054, 0.063],
- 'Zebrafish': [0.16, 0.08, 0.035, 0.060]
- }
- P = np.zeros((comp_h, comp_w, 4), dtype=np.float32)
- P[:, :] = species['Unstable']
-
- UV = np.zeros((comp_h, comp_w, 4), dtype=np.float32)
- UV[:, :, 0] = 1.0
- r = 32
- UV[comp_h / 2 - r:comp_h / 2 + r,
- comp_w / 2 - r:comp_w / 2 + r, 0] = 0.50
- UV[comp_h / 2 - r:comp_h / 2 + r,
- comp_w / 2 - r:comp_w / 2 + r, 1] = 0.25
- UV += np.random.uniform(0.0, 0.01, (comp_h, comp_w, 4))
- UV[:, :, 2] = UV[:, :, 0]
- UV[:, :, 3] = UV[:, :, 1]
-
- self.pingpong = 1
- self.compute = Program(compute_vertex, compute_fragment, 4)
- self.compute["params"] = P
- self.compute["texture"] = UV
- self.compute["position"] = [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
- self.compute["texcoord"] = [(0, 0), (0, 1), (1, 0), (1, 1)]
- self.compute['dt'] = dt
- self.compute['dx'] = 1.0 / comp_w
- self.compute['dy'] = 1.0 / comp_h
- self.compute['dd'] = dd
- self.compute['pingpong'] = self.pingpong
-
- self.render = Program(render_vertex, render_fragment, 4)
- self.render["position"] = [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
- self.render["texcoord"] = [(0, 0), (0, 1), (1, 0), (1, 1)]
- self.render["texture"] = self.compute["texture"]
- self.render['pingpong'] = self.pingpong
-
- self.fbo = FrameBuffer(self.compute["texture"],
- RenderBuffer(self.comp_size))
- set_state(depth_test=False, clear_color='black')
-
- self._timer = app.Timer('auto', connect=self.update, start=True)
-
- self.show()
-
- def on_draw(self, event):
- with self.fbo:
- set_viewport(0, 0, *self.comp_size)
- self.compute["texture"].interpolation = 'nearest'
- self.compute.draw('triangle_strip')
- clear(color=True)
- set_viewport(0, 0, *self.physical_size)
- self.render["texture"].interpolation = 'linear'
- self.render.draw('triangle_strip')
- self.pingpong = 1 - self.pingpong
- self.compute["pingpong"] = self.pingpong
- self.render["pingpong"] = self.pingpong
-
- def on_resize(self, event):
- set_viewport(0, 0, *self.physical_size)
-
-
-if __name__ == '__main__':
- canvas = Canvas()
- app.run()
diff --git a/examples/demo/gloo/high_frequency.py b/examples/demo/gloo/high_frequency.py
deleted file mode 100644
index 1853349..0000000
--- a/examples/demo/gloo/high_frequency.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 20
-# -----------------------------------------------------------------------------
-# Copyright (c) 2014, Nicolas P. Rougier, Guillaume Bâty. All Rights Reserved.
-# Distributed under the (new) BSD License.
-# -----------------------------------------------------------------------------
-# High frequency (below pixel resolution) function plot
-#
-# -> http://blog.hvidtfeldts.net/index.php/2011/07/plotting-high-frequency-fun
-# ctions-using-a-gpu/
-# -> https://www.shadertoy.com/view/4sB3zz
-# -----------------------------------------------------------------------------
-from vispy import gloo, app, keys
-
-VERT_SHADER = """
-attribute vec2 a_position;
-void main (void)
-{
- gl_Position = vec4(a_position, 0.0, 1.0);
-}
-"""
-
-FRAG_SHADER = """
-uniform vec2 u_resolution;
-uniform float u_global_time;
-
-// --- Your function here ---
-float function( float x )
-{
- float d = 3.0 - 2.0*(1.0+cos(u_global_time/5.0))/2.0;
- return sin(pow(x,d))*sin(x);
-}
-// --- Your function here ---
-
-
-float sample(vec2 uv)
-{
- const int samples = 128;
- const float fsamples = float(samples);
- vec2 maxdist = vec2(0.5,1.0)/40.0;
- vec2 halfmaxdist = vec2(0.5) * maxdist;
-
- float stepsize = maxdist.x / fsamples;
- float initial_offset_x = -0.5 * fsamples * stepsize;
- uv.x += initial_offset_x;
- float hit = 0.0;
- for( int i=0; i<samples; ++i )
- {
- float x = uv.x + stepsize * float(i);
- float y = uv.y;
- float fx = function(x);
- float dist = abs(y-fx);
- hit += step(dist, halfmaxdist.y);
- }
- const float arbitraryFactor = 4.5;
- const float arbitraryExp = 0.95;
- return arbitraryFactor * pow( hit / fsamples, arbitraryExp );
-}
-
-void main(void)
-{
- vec2 uv = gl_FragCoord.xy / u_resolution.xy;
- float ymin = -2.0;
- float ymax = +2.0;
- float xmin = 0.0;
- float xmax = xmin + (ymax-ymin)* u_resolution.x / u_resolution.y;
-
- vec2 xy = vec2(xmin,ymin) + uv*vec2(xmax-xmin, ymax-ymin);
- gl_FragColor = vec4(0.0,0.0,0.0, sample(xy));
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self, pause=False):
- app.Canvas.__init__(self, size=(800, 600), keys='interactive')
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- self.program["u_global_time"] = 0
- self.program['a_position'] = [(-1, -1), (-1, +1),
- (+1, -1), (+1, +1)]
-
- self.apply_zoom()
-
- gloo.set_state(blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- self._timer = app.Timer('auto', connect=self.on_timer_event,
- start=True)
-
- self.show()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def on_draw(self, event):
- gloo.clear('white')
- self.program.draw(mode='triangle_strip')
-
- def on_timer_event(self, event):
- if self._timer.running:
- self.program["u_global_time"] += event.dt
- self.update()
-
- def on_key_press(self, event):
- if event.key is keys.SPACE:
- if self._timer.running:
- self._timer.stop()
- else:
- self._timer.start()
-
- def apply_zoom(self):
- self.program["u_resolution"] = self.physical_size
- gloo.set_viewport(0, 0, *self.physical_size)
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/imshow.py b/examples/demo/gloo/imshow.py
deleted file mode 100644
index 97f2d3d..0000000
--- a/examples/demo/gloo/imshow.py
+++ /dev/null
@@ -1,128 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 10
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Show an image using gloo.
-"""
-
-import numpy as np
-from vispy import app
-from vispy.gloo import clear, set_clear_color, set_viewport, Program
-
-
-# Image
-def func(x, y):
- return (1-x/2+x**5+y**3)*np.exp(-x**2-y**2)
-x = np.linspace(-3.0, 3.0, 512).astype(np.float32)
-y = np.linspace(-3.0, 3.0, 512).astype(np.float32)
-X, Y = np.meshgrid(x, y)
-I = func(X, Y)
-
-# Image normalization
-vmin, vmax = I.min(), I.max()
-I = (I-vmin)/(vmax-vmin)
-
-
-# Colormaps
-colormaps = np.ones((16, 512, 4)).astype(np.float32)
-values = np.linspace(0, 1, 512)[1:-1]
-
-# Hot colormap
-colormaps[0, 0] = 0, 0, 1, 1 # Low values (< vmin)
-colormaps[0, -1] = 0, 1, 0, 1 # High values (> vmax)
-colormaps[0, 1:-1, 0] = np.interp(values, [0.00, 0.33, 0.66, 1.00],
- [0.00, 1.00, 1.00, 1.00])
-colormaps[0, 1:-1, 1] = np.interp(values, [0.00, 0.33, 0.66, 1.00],
- [0.00, 0.00, 1.00, 1.00])
-colormaps[0, 1:-1, 2] = np.interp(values, [0.00, 0.33, 0.66, 1.00],
- [0.00, 0.00, 0.00, 1.00])
-
-# Grey colormap
-colormaps[1, 0] = 0, 0, 1, 1 # Low values (< vmin)
-colormaps[1, -1] = 0, 1, 0, 1 # High values (> vmax)
-colormaps[1, 1:-1, 0] = np.interp(values, [0.00, 1.00],
- [0.00, 1.00])
-colormaps[1, 1:-1, 1] = np.interp(values, [0.00, 1.00],
- [0.00, 1.00])
-colormaps[1, 1:-1, 2] = np.interp(values, [0.00, 1.00],
- [0.00, 1.00])
-# Jet colormap
-# ...
-
-
-img_vertex = """
-attribute vec2 position;
-attribute vec2 texcoord;
-
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0 );
- v_texcoord = texcoord;
-}
-"""
-
-img_fragment = """
-uniform float vmin;
-uniform float vmax;
-uniform float cmap;
-
-uniform sampler2D image;
-uniform sampler2D colormaps;
-uniform vec2 colormaps_shape;
-
-varying vec2 v_texcoord;
-void main()
-{
- float value = texture2D(image, v_texcoord).r;
- float index = (cmap+0.5) / colormaps_shape.y;
-
- if( value < vmin ) {
- gl_FragColor = texture2D(colormaps, vec2(0.0,index));
- } else if( value > vmax ) {
- gl_FragColor = texture2D(colormaps, vec2(1.0,index));
- } else {
- value = (value-vmin)/(vmax-vmin);
- value = 1.0/512.0 + 510.0/512.0*value;
- gl_FragColor = texture2D(colormaps, vec2(value,index));
- }
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512),
- keys='interactive')
- self.image = Program(img_vertex, img_fragment, 4)
- self.image['position'] = (-1, -1), (-1, +1), (+1, -1), (+1, +1)
- self.image['texcoord'] = (0, 0), (0, +1), (+1, 0), (+1, +1)
- self.image['vmin'] = +0.1
- self.image['vmax'] = +0.9
- self.image['cmap'] = 0 # Colormap index to use
-
- self.image['colormaps'] = colormaps
- self.image['colormaps'].interpolation = 'linear'
- self.image['colormaps_shape'] = colormaps.shape[1], colormaps.shape[0]
-
- self.image['image'] = I.astype('float32')
- self.image['image'].interpolation = 'linear'
-
- set_clear_color('black')
-
- self.show()
-
- def on_resize(self, event):
- width, height = event.physical_size
- set_viewport(0, 0, *event.physical_size)
-
- def on_draw(self, event):
- clear(color=True, depth=True)
- self.image.draw('triangle_strip')
-
-if __name__ == '__main__':
- canvas = Canvas()
- app.run()
diff --git a/examples/demo/gloo/imshow_cuts.py b/examples/demo/gloo/imshow_cuts.py
deleted file mode 100644
index b4b42d0..0000000
--- a/examples/demo/gloo/imshow_cuts.py
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""
-Show an image using gloo, with on-mouseover cross-section visualizations.
-"""
-
-import numpy as np
-from vispy import app
-from vispy.gloo import set_viewport, clear, set_state, Program
-
-
-# Image
-def func(x, y):
- return (1-x/2+x**5+y**3)*np.exp(-x**2-y**2)
-x = np.linspace(-3.0, 3.0, 512).astype(np.float32)
-y = np.linspace(-3.0, 3.0, 512).astype(np.float32)
-X, Y = np.meshgrid(x, y)
-I = func(X, Y)
-
-# Image normalization
-vmin, vmax = I.min(), I.max()
-I = (I-vmin)/(vmax-vmin)
-
-
-# Colormaps
-colormaps = np.ones((16, 512, 4)).astype(np.float32)
-values = np.linspace(0, 1, 512)[1:-1]
-
-# Hot colormap
-colormaps[0, 0] = 0, 0, 1, 1 # Low values (< vmin)
-colormaps[0, -1] = 0, 1, 0, 1 # High values (> vmax)
-colormaps[0, 1:-1, 0] = np.interp(values, [0.00, 0.33, 0.66, 1.00],
- [0.00, 1.00, 1.00, 1.00])
-colormaps[0, 1:-1, 1] = np.interp(values, [0.00, 0.33, 0.66, 1.00],
- [0.00, 0.00, 1.00, 1.00])
-colormaps[0, 1:-1, 2] = np.interp(values, [0.00, 0.33, 0.66, 1.00],
- [0.00, 0.00, 0.00, 1.00])
-
-# Grey colormap
-colormaps[1, 0] = 0, 0, 1, 1 # Low values (< vmin)
-colormaps[1, -1] = 0, 1, 0, 1 # High values (> vmax)
-colormaps[1, 1:-1, 0] = np.interp(values, [0.00, 1.00],
- [0.00, 1.00])
-colormaps[1, 1:-1, 1] = np.interp(values, [0.00, 1.00],
- [0.00, 1.00])
-colormaps[1, 1:-1, 2] = np.interp(values, [0.00, 1.00],
- [0.00, 1.00])
-# Jet colormap
-# ...
-
-
-lines_vertex = """
-attribute vec2 position;
-attribute vec4 color;
-varying vec4 v_color;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0 );
- v_color = color;
-}
-"""
-
-lines_fragment = """
-varying vec4 v_color;
-void main()
-{
- gl_FragColor = v_color;
-}
-"""
-
-
-image_vertex = """
-attribute vec2 position;
-attribute vec2 texcoord;
-
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0 );
- v_texcoord = texcoord;
-}
-"""
-
-image_fragment = """
-uniform float vmin;
-uniform float vmax;
-uniform float cmap;
-uniform float n_colormaps;
-
-uniform sampler2D image;
-uniform sampler2D colormaps;
-
-varying vec2 v_texcoord;
-void main()
-{
- float value = texture2D(image, v_texcoord).r;
- float index = (cmap+0.5) / n_colormaps;
-
- if( value < vmin ) {
- gl_FragColor = texture2D(colormaps, vec2(0.0,index));
- } else if( value > vmax ) {
- gl_FragColor = texture2D(colormaps, vec2(1.0,index));
- } else {
- value = (value-vmin)/(vmax-vmin);
- value = 1.0/512.0 + 510.0/512.0*value;
- gl_FragColor = texture2D(colormaps, vec2(value,index));
- }
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512),
- keys='interactive')
-
- self.image = Program(image_vertex, image_fragment, 4)
- self.image['position'] = (-1, -1), (-1, +1), (+1, -1), (+1, +1)
- self.image['texcoord'] = (0, 0), (0, +1), (+1, 0), (+1, +1)
- self.image['vmin'] = +0.0
- self.image['vmax'] = +1.0
- self.image['cmap'] = 0 # Colormap index to use
- self.image['colormaps'] = colormaps
- self.image['n_colormaps'] = colormaps.shape[0]
- self.image['image'] = I.astype('float32')
- self.image['image'].interpolation = 'linear'
-
- set_viewport(0, 0, *self.physical_size)
-
- self.lines = Program(lines_vertex, lines_fragment)
- self.lines["position"] = np.zeros((4+4+514+514, 2), np.float32)
- color = np.zeros((4+4+514+514, 4), np.float32)
- color[1:1+2, 3] = 0.25
- color[5:5+2, 3] = 0.25
- color[9:9+512, 3] = 0.5
- color[523:523+512, 3] = 0.5
- self.lines["color"] = color
-
- set_state(clear_color='white', blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- self.show()
-
- def on_resize(self, event):
- set_viewport(0, 0, *event.physical_size)
-
- def on_draw(self, event):
- clear(color=True, depth=True)
- self.image.draw('triangle_strip')
- self.lines.draw('line_strip')
-
- def on_mouse_move(self, event):
- x, y = event.pos
- w, h = self.size
-
- # Make sure the mouse isn't outside of the viewport.
- x = max(0, min(x, w - 1))
- y = max(0, min(y, h - 1))
-
- yf = 1 - y/(h/2.)
- xf = x/(w/2.) - 1
-
- x_norm = (x*512)//w
- y_norm = (y*512)//h
-
- P = np.zeros((4+4+514+514, 2), np.float32)
-
- x_baseline = P[:4]
- y_baseline = P[4:8]
- x_profile = P[8:522]
- y_profile = P[522:]
-
- x_baseline[...] = (-1, yf), (-1, yf), (1, yf), (1, yf)
- y_baseline[...] = (xf, -1), (xf, -1), (xf, 1), (xf, 1)
-
- x_profile[1:-1, 0] = np.linspace(-1, 1, 512)
- x_profile[1:-1, 1] = yf+0.15*I[y_norm, :]
- x_profile[0] = x_profile[1]
- x_profile[-1] = x_profile[-2]
-
- y_profile[1:-1, 0] = xf+0.15*I[:, x_norm]
- y_profile[1:-1, 1] = np.linspace(-1, 1, 512)
- y_profile[0] = y_profile[1]
- y_profile[-1] = y_profile[-2]
-
- self.lines["position"] = P
- self.update()
-
-if __name__ == '__main__':
- canvas = Canvas()
- app.run()
diff --git a/examples/demo/gloo/jfa/fragment_display.glsl b/examples/demo/gloo/jfa/fragment_display.glsl
deleted file mode 100755
index 22fd516..0000000
--- a/examples/demo/gloo/jfa/fragment_display.glsl
+++ /dev/null
@@ -1,23 +0,0 @@
-// Jump flooding algorithm for EDT according
-// to Danielsson (1980) and Guodong Rong (2007).
-// Implementation by Stefan Gustavson 2010.
-// This code is in the public domain.
-
-// This shader displays the final distance field
-// visualized as an RGB image.
-
-uniform sampler2D texture;
-varying vec2 uv;
-
-vec2 remap(vec4 floatdata) {
- vec2 scaled_data = vec2(floatdata.x * 65280. + floatdata.z * 255.,
- floatdata.y * 65280. + floatdata.w * 255.);
- return scaled_data / 32768. - 1.0;
-}
-
-void main( void )
-{
- vec2 distvec = remap(texture2D(texture, uv).rgba);
- vec2 rainbow = 0.5+0.5*(normalize(distvec));
- gl_FragColor = vec4(rainbow, 1.0-length(distvec)*4.0, 1.0);
-}
diff --git a/examples/demo/gloo/jfa/fragment_flood.glsl b/examples/demo/gloo/jfa/fragment_flood.glsl
deleted file mode 100755
index c4b4d30..0000000
--- a/examples/demo/gloo/jfa/fragment_flood.glsl
+++ /dev/null
@@ -1,159 +0,0 @@
-// Jump flooding algorithm for EDT according
-// to Danielsson (1980) and Guodong Rong (2007).
-// Implementation by Stefan Gustavson 2010.
-// This code is in the public domain.
-
-// This code represents one iteration of the flood filling.
-// You need to run it multiple times with different step
-// lengths to perform a full distance transformation.
-
-uniform sampler2D texture;
-varying float stepu;
-varying float stepv;
-varying vec2 uv;
-
-// Helper functions to remap unsigned normalized floats [0.0,1.0]
-// coming from an integer texture to the range we need [-1, 1].
-// The transformations are very specifically designed to map
-// integer texel values exactly to pixel centers, and vice versa.
-// (See fragment_seed.glsl for details.)
-
-vec2 remap(vec4 floatdata) {
- vec2 scaleddata = vec2(floatdata.x * 65280. + floatdata.z * 255.,
- floatdata.y * 65280. + floatdata.w * 255.);
- return scaleddata / 32768. - 1.0;
-}
-
-vec4 remap_inv(vec2 floatvec) {
- vec2 data = (floatvec + 1.0) * 32768.;
- float x = floor(data.x / 256.);
- float y = floor(data.y / 256.);
- return vec4(x, y, data.x - x * 256., data.y - y * 256.) / 255.;
-}
-
-void main( void )
-{
- // Search for better distance vectors among 8 candidates
- vec2 stepvec; // Relative offset to candidate being tested
- vec2 newvec; // Absolute position of that candidate
- vec3 newseed; // Closest point from that candidate (.xy) and its distance (.z)
- vec3 bestseed; // Closest seed so far
- bestseed.xy = remap(texture2D(texture, uv).rgba);
- bestseed.z = length(bestseed.xy);
-
- // This code depends on the texture having a CLAMP_TO_BORDER
- // attribute and a border color with R = 0.
- // The commented-out lines handle clamping to the edge explicitly
- // to avoid propagating incorrect vectors when looking outside
- // of [0,1] in u and/or v.
- // These explicit conditionals cause a slowdown of about 25%.
- // Sometimes a periodic transform with edge repeats might be
- // what you want. In that case, the texture wrap mode can be
- // set to GL_REPEAT, and the shader code can be left unchanged.
-
- stepvec = vec2(-stepu, -stepv);
- newvec = uv + stepvec;
- if ( all( bvec4( lessThan(newvec, vec2(1.0)), greaterThan(newvec, vec2(0.0)) ) ) ) {
- newseed.xy = remap(texture2D(texture, newvec).rgba);
- if(newseed.x > -0.99999) { // if the new seed is not "indeterminate distance"
- newseed.xy = newseed.xy + stepvec;
- newseed.z = length(newseed.xy);
- if(newseed.z < bestseed.z) {
- bestseed = newseed;
- }
- }
- }
-
- stepvec = vec2(-stepu, 0.0);
- newvec = uv + stepvec;
- if ( all( bvec4( lessThan(newvec, vec2(1.0)), greaterThan(newvec, vec2(0.0)) ) ) ) {
- newseed.xy = remap(texture2D(texture, newvec).rgba);
- if(newseed.x > -0.99999) { // if the new seed is not "indeterminate distance"
- newseed.xy = newseed.xy + stepvec;
- newseed.z = length(newseed.xy);
- if(newseed.z < bestseed.z) {
- bestseed = newseed;
- }
- }
- }
-
- stepvec = vec2(-stepu, stepv);
- newvec = uv + stepvec;
- if ( all( bvec4( lessThan(newvec, vec2(1.0)), greaterThan(newvec, vec2(0.0)) ) ) ) {
- newseed.xy = remap(texture2D(texture, newvec).rgba);
- if(newseed.x > -0.99999) { // if the new seed is not "indeterminate distance"
- newseed.xy = newseed.xy + stepvec;
- newseed.z = length(newseed.xy);
- if(newseed.z < bestseed.z) {
- bestseed = newseed;
- }
- }
- }
-
- stepvec = vec2(0.0, -stepv);
- newvec = uv + stepvec;
- if ( all( bvec4( lessThan(newvec, vec2(1.0)), greaterThan(newvec, vec2(0.0)) ) ) ) {
- newseed.xy = remap(texture2D(texture, newvec).rgba);
- if(newseed.x > -0.99999) { // if the new seed is not "indeterminate distance"
- newseed.xy = newseed.xy + stepvec;
- newseed.z = length(newseed.xy);
- if(newseed.z < bestseed.z) {
- bestseed = newseed;
- }
- }
- }
-
- stepvec = vec2(0.0, stepv);
- newvec = uv + stepvec;
- if ( all( bvec4( lessThan(newvec, vec2(1.0)), greaterThan(newvec, vec2(0.0)) ) ) ) {
- newseed.xy = remap(texture2D(texture, newvec).rgba);
- if(newseed.x > -0.99999) { // if the new seed is not "indeterminate distance"
- newseed.xy = newseed.xy + stepvec;
- newseed.z = length(newseed.xy);
- if(newseed.z < bestseed.z) {
- bestseed = newseed;
- }
- }
- }
-
- stepvec = vec2(stepu, -stepv);
- newvec = uv + stepvec;
- if ( all( bvec4( lessThan(newvec, vec2(1.0)), greaterThan(newvec, vec2(0.0)) ) ) ) {
- newseed.xy = remap(texture2D(texture, newvec).rgba);
- if(newseed.x > -0.99999) { // if the new seed is not "indeterminate distance"
- newseed.xy = newseed.xy + stepvec;
- newseed.z = length(newseed.xy);
- if(newseed.z < bestseed.z) {
- bestseed = newseed;
- }
- }
- }
-
- stepvec = vec2(stepu, 0.0);
- newvec = uv + stepvec;
- if ( all( bvec4( lessThan(newvec, vec2(1.0)), greaterThan(newvec, vec2(0.0)) ) ) ) {
- newseed.xy = remap(texture2D(texture, newvec).rgba);
- if(newseed.x > -0.99999) { // if the new seed is not "indeterminate distance"
- newseed.xy = newseed.xy + stepvec;
- newseed.z = length(newseed.xy);
- if(newseed.z < bestseed.z) {
- bestseed = newseed;
- }
- }
- }
-
- stepvec = vec2(stepu, stepv);
- newvec = uv + stepvec;
- if ( all( bvec4( lessThan(newvec, vec2(1.0)), greaterThan(newvec, vec2(0.0)) ) ) ) {
- newseed.xy = remap(texture2D(texture, newvec).rgba);
- if(newseed.x > -0.99999) { // if the new seed is not "indeterminate distance"
- newseed.xy = newseed.xy + stepvec;
- newseed.z = length(newseed.xy);
- if(newseed.z < bestseed.z) {
- bestseed = newseed;
- }
- }
- }
-
- gl_FragColor = remap_inv(bestseed.xy);
-}
diff --git a/examples/demo/gloo/jfa/fragment_seed.glsl b/examples/demo/gloo/jfa/fragment_seed.glsl
deleted file mode 100755
index 1affab1..0000000
--- a/examples/demo/gloo/jfa/fragment_seed.glsl
+++ /dev/null
@@ -1,21 +0,0 @@
-// Jump flooding algorithm for EDT according
-// to Danielsson (1980) and Guodong Rong (2007).
-// Implementation by Stefan Gustavson 2010.
-// This code is in the public domain.
-
-// This shader initializes the distance field
-// in preparation for the flood filling.
-
-uniform sampler2D texture;
-varying float stepu;
-varying float stepv;
-varying vec2 uv;
-
-void main( void )
-{
- float pixel = texture2D(texture, uv).r;
- vec4 myzero = vec4(128. / 255., 128. / 255., 0., 0.); // Zero
- vec4 myinfinity = vec4(0., 0., 0., 0.); // Infinity
- // Pixels > 0.5 are objects, others are background
- gl_FragColor = pixel > 0.5 ? myinfinity : myzero;
-}
diff --git a/examples/demo/gloo/jfa/jfa_translation.py b/examples/demo/gloo/jfa/jfa_translation.py
deleted file mode 100644
index faf3e33..0000000
--- a/examples/demo/gloo/jfa/jfa_translation.py
+++ /dev/null
@@ -1,259 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Demo of jump flooding algoritm for EDT using GLSL
-Author: Stefan Gustavson (stefan.gustavson at gmail.com)
-2010-08-24. This code is in the public domain.
-
-Adapted to `vispy` by Eric Larson <larson.eric.d at gmail.com>.
-
-This version is a translation of the OSX C code to Python.
-Two modifications were made for OpenGL ES 2.0 compatibility:
-
- 1. GL_CLAMP_TO_BORDER was changed to GL_CLAMP_TO_EDGE, with
- corresponding shader changes.
- 2. GL_RG16 was changed to GL_RGBA with corresponding shader changes
- (including hard-coding "texlevels" at 65536).
-
-"""
-
-import numpy as np
-from os import path as op
-from vispy.ext import glfw
-from vispy.io import load_data_file
-from OpenGL import GL as gl
-from OpenGL import GLU as glu
-from PIL import Image
-import time
-
-this_dir = op.abspath(op.dirname(__file__))
-
-
-def createShader(vert_fname, frag_fname):
- """createShader - create, load, compile and link the shader object"""
- with open(op.join(this_dir, vert_fname), 'rb') as fid:
- vert = fid.read().decode('ASCII')
- with open(op.join(this_dir, frag_fname), 'rb') as fid:
- frag = fid.read().decode('ASCII')
- vertexShader = gl.glCreateShader(gl.GL_VERTEX_SHADER)
- gl.glShaderSource(vertexShader, vert)
- gl.glCompileShader(vertexShader)
- fragmentShader = gl.glCreateShader(gl.GL_FRAGMENT_SHADER)
- gl.glShaderSource(fragmentShader, frag)
- gl.glCompileShader(fragmentShader)
- programObj = gl.glCreateProgram()
- gl.glAttachShader(programObj, vertexShader)
- gl.glAttachShader(programObj, fragmentShader)
- gl.glLinkProgram(programObj)
- checkGLError()
- return programObj
-
-
-def setUniformVariables(programObj, texture, texw, texh, step):
- """setUniformVariables - set the uniform shader variables we need"""
- gl.glUseProgram(programObj)
- location_texture = gl.glGetUniformLocation(programObj, "texture")
- if location_texture != -1:
- gl.glUniform1i(location_texture, texture)
- location_texw = gl.glGetUniformLocation(programObj, "texw")
- if location_texw != -1:
- gl.glUniform1f(location_texw, texw)
- location_texh = gl.glGetUniformLocation(programObj, "texh")
- if location_texh != -1:
- gl.glUniform1f(location_texh, texh)
- location_step = gl.glGetUniformLocation(programObj, "step")
- if(location_step != -1):
- gl.glUniform1f(location_step, step)
- gl.glUseProgram(0)
- checkGLError()
-
-
-def loadImage(filename): # adapted for Python
- img = Image.open(filename)
- w, h = img.size
- x = np.array(img)[::-1].tostring()
- assert len(x) == w * h
- return x, w, h
-
-
-def loadShapeTexture(filename, texID):
- """loadShapeTexture - load 8-bit shape texture data
- from a TGA file and set up the corresponding texture object."""
- data, texw, texh = loadImage(load_data_file('jfa/' + filename))
- gl.glActiveTexture(gl.GL_TEXTURE0)
- gl.glBindTexture(gl.GL_TEXTURE_2D, texID)
- # Load image into texture
- gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_LUMINANCE, texw, texh, 0,
- gl.GL_LUMINANCE, gl.GL_UNSIGNED_BYTE, data)
- # This is the input image. We want unaltered 1-to-1 pixel values,
- # so specify nearest neighbor sampling to be sure.
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER,
- gl.GL_NEAREST)
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER,
- gl.GL_NEAREST)
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_S, gl.GL_REPEAT)
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_T, gl.GL_REPEAT)
- checkGLError()
- return texw, texh
-
-
-def createBufferTexture(texID, texw, texh):
- """createBufferTexture - create an 8-bit texture render target"""
- gl.glActiveTexture(gl.GL_TEXTURE0)
- gl.glBindTexture(gl.GL_TEXTURE_2D, texID)
- black = (0., 0., 0., 0.)
- # The special shader used to render this texture performs a
- # per-pixel image processing where point sampling is required,
- # so specify nearest neighbor sampling.
- #
- # Also, the flood fill shader handles its own edge clamping, so
- # texture mode GL_REPEAT is inconsequential. "Zero outside" would
- # be useful, but separate edge values are deprecated in OpenGL.
- #
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER,
- gl.GL_NEAREST)
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER,
- gl.GL_NEAREST)
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_S,
- gl.GL_CLAMP_TO_EDGE)
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_T,
- gl.GL_CLAMP_TO_EDGE)
- gl.glTexParameterfv(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_BORDER_COLOR, black)
- gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, texw, texh, 0,
- gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, '\x00' * texw*texh*4)
- gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
- checkGLError()
-
-
-t0 = 0.0
-frames = 0
-
-
-def showFPS(texw, texh):
- """showFPS - Calculate and report texture size and frames per second
- in the window title bar (updated once per second)"""
- global frames, t0
- t = time.time()
- if (t - t0) > 1.:
- fps = frames / (t - t0)
- titlestr = "%sx%s texture, %.1f FPS" % (texw, texh, fps)
- glfw.glfwSetWindowTitle(window, titlestr)
- t0 = t
- frames = 0
- frames += 1
-
-
-def checkGLError():
- status = gl.glGetError()
- if status != gl.GL_NO_ERROR:
- raise RuntimeError('gl error %s' % (status,))
-
-
-def renderScene(programObj, width, height):
- """renderScene - the OpenGL commands to render our scene."""
- gl.glMatrixMode(gl.GL_PROJECTION)
- gl.glLoadIdentity()
- glu.gluOrtho2D(0, width, 0, height)
- gl.glViewport(0, 0, width, height)
- gl.glMatrixMode(gl.GL_MODELVIEW)
- gl.glLoadIdentity()
- gl.glUseProgram(programObj)
- # Draw one texture mapped quad in the (x,y) plane
- gl.glBegin(gl.GL_QUADS)
- gl.glTexCoord2f(0., 0.)
- gl.glVertex2f(0., 0.)
- gl.glTexCoord2f(1., 0.)
- gl.glVertex2f(float(width), 0.)
- gl.glTexCoord2f(1., 1.)
- gl.glVertex2f(float(width), float(height))
- gl.glTexCoord2f(0., 1.)
- gl.glVertex2f(0., float(height))
- gl.glEnd()
- gl.glUseProgram(0)
- checkGLError()
-
-
-useShaders = True
-glfw.glfwInit()
-window = glfw.glfwCreateWindow(512, 512)
-glfw.glfwShowWindow(window)
-glfw.glfwMakeContextCurrent(window)
-time.sleep(400e-3) # needed on Linux for window to show up
-
-# Load one texture with the original image
-# and create two textures of the same size for the iterative rendering
-gl.glEnable(gl.GL_TEXTURE_2D)
-gl.glActiveTexture(gl.GL_TEXTURE0)
-textureID = gl.glGenTextures(3)
-texw, texh = loadShapeTexture("shape1.tga", textureID[0])
-createBufferTexture(textureID[1], texw, texh)
-createBufferTexture(textureID[2], texw, texh)
-fboID = gl.glGenFramebuffers(1)
-programObj0 = createShader("vertex.glsl", "fragment_seed.glsl")
-programObj1 = createShader("vertex.glsl", "fragment_flood.glsl")
-programObj2 = createShader("vertex.glsl", "fragment_display.glsl")
-glfw.glfwSwapInterval(0)
-running = True
-while running:
- showFPS(texw, texh)
- if not useShaders:
- gl.glBindTexture(gl.GL_TEXTURE_2D, textureID[0]) # Pass-through
- else:
- setUniformVariables(programObj0, 0, texw, texh, 0)
- gl.glBindTexture(gl.GL_TEXTURE_2D, textureID[0])
- gl.glBindFramebuffer(gl.GL_DRAW_FRAMEBUFFER, fboID)
- lastRendered = 1
- gl.glFramebufferTexture2D(gl.GL_DRAW_FRAMEBUFFER,
- gl.GL_COLOR_ATTACHMENT0,
- gl.GL_TEXTURE_2D,
- textureID[lastRendered], 0)
- renderScene(programObj0, texw, texh)
- stepsize = texw//2 if texw > texh else texh//2
- while stepsize > 0:
- setUniformVariables(programObj1, 0, texw, texh, stepsize)
- gl.glBindTexture(gl.GL_TEXTURE_2D, textureID[lastRendered])
- lastRendered = 1 if lastRendered == 2 else 2
- gl.glFramebufferTexture2D(gl.GL_DRAW_FRAMEBUFFER,
- gl.GL_COLOR_ATTACHMENT0,
- gl.GL_TEXTURE_2D,
- textureID[lastRendered], 0)
- renderScene(programObj1, texw, texh)
- stepsize = stepsize // 2
- gl.glBindFramebuffer(gl.GL_DRAW_FRAMEBUFFER, 0)
- gl.glBindTexture(gl.GL_TEXTURE_2D, textureID[lastRendered])
-
- width, height = glfw.glfwGetWindowSize(window)
- height = max(height, 1)
- width = max(width, 1)
- setUniformVariables(programObj2, 0, texw, texh, 0)
- renderScene(programObj2, width, height)
-
- glfw.glfwSwapBuffers(window)
- glfw.glfwPollEvents()
- if glfw.glfwGetKey(window, glfw.GLFW_KEY_1) == glfw.GLFW_PRESS:
- texw, texh = loadShapeTexture("shape1.tga", textureID[0])
- createBufferTexture(textureID[1], texw, texh)
- createBufferTexture(textureID[2], texw, texh)
- if glfw.glfwGetKey(window, glfw.GLFW_KEY_2):
- texw, texh = loadShapeTexture("shape2.tga", textureID[0])
- createBufferTexture(textureID[1], texw, texh)
- createBufferTexture(textureID[2], texw, texh)
- if glfw.glfwGetKey(window, glfw.GLFW_KEY_3):
- texw, texh = loadShapeTexture("shape3.tga", textureID[0])
- createBufferTexture(textureID[1], texw, texh)
- createBufferTexture(textureID[2], texw, texh)
- if glfw.glfwGetKey(window, glfw.GLFW_KEY_4):
- texw, texh = loadShapeTexture("shape4.tga", textureID[0])
- createBufferTexture(textureID[1], texw, texh)
- createBufferTexture(textureID[2], texw, texh)
- if glfw.glfwGetKey(window, glfw.GLFW_KEY_F1):
- useShaders = True
- if glfw.glfwGetKey(window, glfw.GLFW_KEY_F2):
- useShaders = False
- # Check if the ESC key is pressed or the window has been closed
- running = not glfw.glfwGetKey(window, glfw.GLFW_KEY_ESCAPE)
-glfw.glfwTerminate()
diff --git a/examples/demo/gloo/jfa/jfa_vispy.py b/examples/demo/gloo/jfa/jfa_vispy.py
deleted file mode 100644
index fc3b200..0000000
--- a/examples/demo/gloo/jfa/jfa_vispy.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# vispy: testskip - because this example sets inactive attributes on Travis
-
-"""
-Demo of jump flooding algoritm for EDT using GLSL
-Author: Stefan Gustavson (stefan.gustavson at gmail.com)
-2010-08-24. This code is in the public domain.
-
-Adapted to `vispy` by Eric Larson <larson.eric.d at gmail.com>.
-
-This version is a vispy-ized translation of jfa_translate.py.
-"""
-
-import numpy as np
-from os import path as op
-import sys
-
-from vispy import app
-from vispy.gloo import (Program, FrameBuffer, VertexBuffer, Texture2D,
- set_viewport)
-from vispy.io import load_data_file, imread
-
-this_dir = op.abspath(op.dirname(__file__))
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- self.use_shaders = True
- app.Canvas.__init__(self, size=(512, 512), keys='interactive')
- # Note: read as bytes, then decode; py2.6 compat
- with open(op.join(this_dir, 'vertex_vispy.glsl'), 'rb') as fid:
- vert = fid.read().decode('ASCII')
- with open(op.join(this_dir, 'fragment_seed.glsl'), 'rb') as f:
- frag_seed = f.read().decode('ASCII')
- with open(op.join(this_dir, 'fragment_flood.glsl'), 'rb') as f:
- frag_flood = f.read().decode('ASCII')
- with open(op.join(this_dir, 'fragment_display.glsl'), 'rb') as f:
- frag_display = f.read().decode('ASCII')
- self.programs = [Program(vert, frag_seed),
- Program(vert, frag_flood),
- Program(vert, frag_display)]
- # Initialize variables
- # using two FBs slightly faster than switching on one
- self.fbo_to = [FrameBuffer(), FrameBuffer()]
- self._setup_textures('shape1.tga')
- vtype = np.dtype([('position', 'f4', 2), ('texcoord', 'f4', 2)])
- vertices = np.zeros(4, dtype=vtype)
- vertices['position'] = [[-1., -1.], [-1., 1.], [1., -1.], [1., 1.]]
- vertices['texcoord'] = [[0., 0.], [0., 1.], [1., 0.], [1., 1.]]
- vertices = VertexBuffer(vertices)
- for program in self.programs:
- program.bind(vertices)
- self._timer = app.Timer('auto', self.update, start=True)
-
- self.show()
-
- def _setup_textures(self, fname):
- data = imread(load_data_file('jfa/' + fname))[::-1].copy()
- if data.ndim == 3:
- data = data[:, :, 0] # Travis gets 2, I get three?
- self.texture_size = data.shape[:2]
- self.orig_tex = Texture2D(data, format='luminance', wrapping='repeat',
- interpolation='nearest')
- self.comp_texs = []
- data = np.zeros(self.texture_size + (4,), np.float32)
- for _ in range(2):
- tex = Texture2D(data, format='rgba', wrapping='clamp_to_edge',
- interpolation='nearest')
- self.comp_texs.append(tex)
- self.fbo_to[0].color_buffer = self.comp_texs[0]
- self.fbo_to[1].color_buffer = self.comp_texs[1]
- for program in self.programs[1:2]:
- program['texw'], program['texh'] = self.texture_size
-
- def on_draw(self, event):
- if self.use_shaders:
- last_rend = 0
- self.fbo_to[last_rend].activate()
- set_viewport(0, 0, *self.texture_size)
- self.programs[0]['texture'] = self.orig_tex
- self.programs[0].draw('triangle_strip')
- self.fbo_to[last_rend].deactivate()
- stepsize = (np.array(self.texture_size) // 2).max()
- while stepsize > 0:
- self.programs[1]['step'] = stepsize
- self.programs[1]['texture'] = self.comp_texs[last_rend]
- last_rend = 1 if last_rend == 0 else 0
- self.fbo_to[last_rend].activate()
- set_viewport(0, 0, *self.texture_size)
- self.programs[1].draw('triangle_strip')
- self.fbo_to[last_rend].deactivate()
- stepsize //= 2
- self.programs[2]['texture'] = self.comp_texs[last_rend]
- else:
- self.programs[2]['texture'] = self.orig_tex
- set_viewport(0, 0, *self.physical_size)
- self.programs[2].draw('triangle_strip')
-
- def on_key_press(self, event):
- if event.key is not None and event.key.name in '1234':
- fname = "shape%s.tga" % event.key.name
- self._setup_textures(fname)
- elif event.key == 'F1':
- self.use_shaders = True
- elif event.key == 'F2':
- self.use_shaders = False
-
-
-def fun(x):
- c.title = 'FPS: %0.1f' % x
-
-if __name__ == '__main__':
- c = Canvas()
- c.measure_fps(callback=fun)
- if sys.flags.interactive != 1:
- c.app.run()
diff --git a/examples/demo/gloo/jfa/vertex.glsl b/examples/demo/gloo/jfa/vertex.glsl
deleted file mode 100755
index 8592020..0000000
--- a/examples/demo/gloo/jfa/vertex.glsl
+++ /dev/null
@@ -1,24 +0,0 @@
-// Jump flooding algorithm for EDT according
-// to Danielsson (1980) and Guodong Rong (2007).
-// Implementation by Stefan Gustavson 2010.
-// This code is in the public domain.
-
-// This code represents one iteration of the flood filling.
-// You need to run it multiple times with different step
-// lengths to perform a full distance transformation.
-
-uniform float texw;
-uniform float texh;
-uniform float step;
-varying float stepu;
-varying float stepv;
-varying vec2 uv;
-
-void main( void )
-{
- // Get the texture coordinates
- uv = gl_MultiTexCoord0.xy;
- stepu = step / texw; // Saves a division in the fragment shader
- stepv = step / texh;
- gl_Position = ftransform();
-}
diff --git a/examples/demo/gloo/jfa/vertex_vispy.glsl b/examples/demo/gloo/jfa/vertex_vispy.glsl
deleted file mode 100755
index 85c59d1..0000000
--- a/examples/demo/gloo/jfa/vertex_vispy.glsl
+++ /dev/null
@@ -1,26 +0,0 @@
-// Jump flooding algorithm for EDT according
-// to Danielsson (1980) and Guodong Rong (2007).
-// Implementation by Stefan Gustavson 2010.
-// This code is in the public domain.
-
-// This code represents one iteration of the flood filling.
-// You need to run it multiple times with different step
-// lengths to perform a full distance transformation.
-
-uniform float texw;
-uniform float texh;
-uniform float step;
-attribute vec2 position;
-attribute vec2 texcoord;
-varying float stepu;
-varying float stepv;
-varying vec2 uv;
-
-void main( void )
-{
- // Get the texture coordinates
- uv = texcoord.xy;
- stepu = step / texw; // Saves a division in the fragment shader
- stepv = step / texh;
- gl_Position = vec4(position.xy, 0., 1.);
-}
diff --git a/examples/demo/gloo/mandelbrot.py b/examples/demo/gloo/mandelbrot.py
deleted file mode 100644
index 321dc0c..0000000
--- a/examples/demo/gloo/mandelbrot.py
+++ /dev/null
@@ -1,181 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: John David Reaver
-# Date: 04/29/2014
-# -----------------------------------------------------------------------------
-
-from vispy import app, gloo
-
-# Shader source code
-# -----------------------------------------------------------------------------
-vertex = """
-attribute vec2 position;
-
-void main()
-{
- gl_Position = vec4(position, 0, 1.0);
-}
-"""
-
-fragment = """
-uniform vec2 resolution;
-uniform vec2 center;
-uniform float scale;
-
-vec3 hot(float t)
-{
- return vec3(smoothstep(0.00,0.33,t),
- smoothstep(0.33,0.66,t),
- smoothstep(0.66,1.00,t));
-}
-
-void main()
-{
-
- const int n = 300;
- const float log_2 = 0.6931471805599453;
-
- vec2 c;
-
- // Recover coordinates from pixel coordinates
- c.x = (gl_FragCoord.x / resolution.x - 0.5) * scale + center.x;
- c.y = (gl_FragCoord.y / resolution.y - 0.5) * scale + center.y;
-
- float x, y, d;
- int i;
- vec2 z = c;
- for(i = 0; i < n; ++i)
- {
- x = (z.x*z.x - z.y*z.y) + c.x;
- y = (z.y*z.x + z.x*z.y) + c.y;
- d = x*x + y*y;
- if (d > 4.0) break;
- z = vec2(x,y);
- }
- if ( i < n ) {
- float nu = log(log(sqrt(d))/log_2)/log_2;
- float index = float(i) + 1.0 - nu;
- float v = pow(index/float(n),0.5);
- gl_FragColor = vec4(hot(v),1.0);
- } else {
- gl_FragColor = vec4(hot(0.0),1.0);
- }
-}
-
-"""
-
-
-# vispy Canvas
-# -----------------------------------------------------------------------------
-class Canvas(app.Canvas):
-
- def __init__(self, *args, **kwargs):
- app.Canvas.__init__(self, *args, **kwargs)
- self.program = gloo.Program(vertex, fragment)
-
- # Draw a rectangle that takes up the whole screen. All of the work is
- # done in the shader.
- self.program["position"] = [(-1, -1), (-1, 1), (1, 1),
- (-1, -1), (1, 1), (1, -1)]
-
- self.scale = self.program["scale"] = 3
- self.center = self.program["center"] = [-0.5, 0]
- self.apply_zoom()
-
- self.bounds = [-2, 2]
- self.min_scale = 0.00005
- self.max_scale = 4
-
- gloo.set_clear_color(color='black')
-
- self._timer = app.Timer('auto', connect=self.update, start=True)
-
- self.show()
-
- def on_draw(self, event):
- self.program.draw()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def apply_zoom(self):
- width, height = self.physical_size
- gloo.set_viewport(0, 0, width, height)
- self.program['resolution'] = [width, height]
-
- def on_mouse_move(self, event):
- """Pan the view based on the change in mouse position."""
- if event.is_dragging and event.buttons[0] == 1:
- x0, y0 = event.last_event.pos[0], event.last_event.pos[1]
- x1, y1 = event.pos[0], event.pos[1]
- X0, Y0 = self.pixel_to_coords(float(x0), float(y0))
- X1, Y1 = self.pixel_to_coords(float(x1), float(y1))
- self.translate_center(X1 - X0, Y1 - Y0)
-
- def translate_center(self, dx, dy):
- """Translates the center point, and keeps it in bounds."""
- center = self.center
- center[0] -= dx
- center[1] -= dy
- center[0] = min(max(center[0], self.bounds[0]), self.bounds[1])
- center[1] = min(max(center[1], self.bounds[0]), self.bounds[1])
- self.program["center"] = self.center = center
-
- def pixel_to_coords(self, x, y):
- """Convert pixel coordinates to Mandelbrot set coordinates."""
- rx, ry = self.size
- nx = (x / rx - 0.5) * self.scale + self.center[0]
- ny = ((ry - y) / ry - 0.5) * self.scale + self.center[1]
- return [nx, ny]
-
- def on_mouse_wheel(self, event):
- """Use the mouse wheel to zoom."""
- delta = event.delta[1]
- if delta > 0: # Zoom in
- factor = 0.9
- elif delta < 0: # Zoom out
- factor = 1 / 0.9
- for _ in range(int(abs(delta))):
- self.zoom(factor, event.pos)
-
- def on_key_press(self, event):
- """Use + or - to zoom in and out.
-
- The mouse wheel can be used to zoom, but some people don't have mouse
- wheels :)
-
- """
-
- if event.text == '+' or event.text == '=':
- self.zoom(0.9)
- elif event.text == '-':
- self.zoom(1/0.9)
-
- def zoom(self, factor, mouse_coords=None):
- """Factors less than zero zoom in, and greater than zero zoom out.
-
- If mouse_coords is given, the point under the mouse stays stationary
- while zooming. mouse_coords should come from MouseEvent.pos.
-
- """
- if mouse_coords is not None: # Record the position of the mouse
- x, y = float(mouse_coords[0]), float(mouse_coords[1])
- x0, y0 = self.pixel_to_coords(x, y)
-
- self.scale *= factor
- self.scale = max(min(self.scale, self.max_scale), self.min_scale)
- self.program["scale"] = self.scale
-
- # Translate so the mouse point is stationary
- if mouse_coords is not None:
- x1, y1 = self.pixel_to_coords(x, y)
- self.translate_center(x1 - x0, y1 - y0)
-
-
-if __name__ == '__main__':
- canvas = Canvas(size=(800, 800), keys='interactive')
- app.run()
diff --git a/examples/demo/gloo/mandelbrot_double.py b/examples/demo/gloo/mandelbrot_double.py
deleted file mode 100644
index 659bea5..0000000
--- a/examples/demo/gloo/mandelbrot_double.py
+++ /dev/null
@@ -1,302 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: John David Reaver
-# Date: 09/12/2014
-# -----------------------------------------------------------------------------
-
-"""
-Example demonstrating the use of emulated double-precision floating point
-numbers. Based off of mandelbrot.py.
-
-The shader program emulates double-precision variables using a vec2 instead of
-single-precision floats. Any function starting with ds_* operates on these
-variables. See http://www.thasler.org/blog/?p=93.
-
-NOTE: Some NVIDIA cards optimize the double-precision code away. Results are
-therefore hardware dependent.
-
-"""
-
-from __future__ import division
-
-import numpy as np
-from vispy import app, gloo
-
-# Shader source code
-# -----------------------------------------------------------------------------
-vertex = """
-attribute vec2 position;
-
-void main()
-{
- gl_Position = vec4(position, 0, 1.0);
-}
-"""
-
-fragment = """
-#pragma optionNV(fastmath off)
-#pragma optionNV(fastprecision off)
-
-uniform vec2 inv_resolution_x; // Inverse resolutions
-uniform vec2 inv_resolution_y;
-uniform vec2 center_x;
-uniform vec2 center_y;
-uniform vec2 scale;
-uniform int iter;
-
-// Jet color scheme
-vec4 color_scheme(float x) {
- vec3 a, b;
- float c;
- if (x < 0.34) {
- a = vec3(0, 0, 0.5);
- b = vec3(0, 0.8, 0.95);
- c = (x - 0.0) / (0.34 - 0.0);
- } else if (x < 0.64) {
- a = vec3(0, 0.8, 0.95);
- b = vec3(0.85, 1, 0.04);
- c = (x - 0.34) / (0.64 - 0.34);
- } else if (x < 0.89) {
- a = vec3(0.85, 1, 0.04);
- b = vec3(0.96, 0.7, 0);
- c = (x - 0.64) / (0.89 - 0.64);
- } else {
- a = vec3(0.96, 0.7, 0);
- b = vec3(0.5, 0, 0);
- c = (x - 0.89) / (1.0 - 0.89);
- }
- return vec4(mix(a, b, c), 1.0);
-}
-
-vec2 ds_set(float a) {
- // Create an emulated double by storing first part of float in first half
- // of vec2
- vec2 z;
- z.x = a;
- z.y = 0.0;
- return z;
-}
-
-vec2 ds_add (vec2 dsa, vec2 dsb)
-{
- // Add two emulated doubles. Complexity comes from carry-over.
- vec2 dsc;
- float t1, t2, e;
-
- t1 = dsa.x + dsb.x;
- e = t1 - dsa.x;
- t2 = ((dsb.x - e) + (dsa.x - (t1 - e))) + dsa.y + dsb.y;
-
- dsc.x = t1 + t2;
- dsc.y = t2 - (dsc.x - t1);
- return dsc;
-}
-
-vec2 ds_mul (vec2 dsa, vec2 dsb)
-{
- vec2 dsc;
- float c11, c21, c2, e, t1, t2;
- float a1, a2, b1, b2, cona, conb, split = 8193.;
-
- cona = dsa.x * split;
- conb = dsb.x * split;
- a1 = cona - (cona - dsa.x);
- b1 = conb - (conb - dsb.x);
- a2 = dsa.x - a1;
- b2 = dsb.x - b1;
-
- c11 = dsa.x * dsb.x;
- c21 = a2 * b2 + (a2 * b1 + (a1 * b2 + (a1 * b1 - c11)));
-
- c2 = dsa.x * dsb.y + dsa.y * dsb.x;
-
- t1 = c11 + c2;
- e = t1 - c11;
- t2 = dsa.y * dsb.y + ((c2 - e) + (c11 - (t1 - e))) + c21;
-
- dsc.x = t1 + t2;
- dsc.y = t2 - (dsc.x - t1);
-
- return dsc;
-}
-
-// Compare: res = -1 if a < b
-// = 0 if a == b
-// = 1 if a > b
-float ds_compare(vec2 dsa, vec2 dsb)
-{
- if (dsa.x < dsb.x) return -1.;
- else if (dsa.x == dsb.x) {
- if (dsa.y < dsb.y) return -1.;
- else if (dsa.y == dsb.y) return 0.;
- else return 1.;
- }
- else return 1.;
-}
-
-void main() {
- vec2 z_x, z_y, c_x, c_y, x, y, frag_x, frag_y;
- vec2 four = ds_set(4.0);
- vec2 point5 = ds_set(0.5);
-
- // Recover coordinates from pixel coordinates
- frag_x = ds_set(gl_FragCoord.x);
- frag_y = ds_set(gl_FragCoord.y);
-
- c_x = ds_add(ds_mul(frag_x, inv_resolution_x), -point5);
- c_x = ds_add(ds_mul(c_x, scale), center_x);
- c_y = ds_add(ds_mul(frag_y, inv_resolution_y), -point5);
- c_y = ds_add(ds_mul(c_y, scale), center_y);
-
-
- // Main Mandelbrot computation
- int i;
- z_x = c_x;
- z_y = c_y;
- for(i = 0; i < iter; i++) {
- x = ds_add(ds_add(ds_mul(z_x, z_x), -ds_mul(z_y, z_y)), c_x);
- y = ds_add(ds_add(ds_mul(z_y, z_x), ds_mul(z_x, z_y)), c_y);
-
- if(ds_compare(ds_add(ds_mul(x, x), ds_mul(y, y)), four) > 0.) break;
- z_x = x;
- z_y = y;
- }
-
- // Convert iterations to color
- float color = 1.0 - float(i) / float(iter);
- gl_FragColor = color_scheme(color);
-
-}
-"""
-
-
-# vispy Canvas
-# -----------------------------------------------------------------------------
-class Canvas(app.Canvas):
-
- def __init__(self, *args, **kwargs):
- app.Canvas.__init__(self, *args, **kwargs)
- self.program = gloo.Program(vertex, fragment)
-
- # Draw a rectangle that takes up the whole screen. All of the work is
- # done in the shader.
- self.program["position"] = [(-1, -1), (-1, 1), (1, 1),
- (-1, -1), (1, 1), (1, -1)]
-
- self.scale = 3
- self.program["scale"] = set_emulated_double(self.scale)
- self.center = [-0.5, 0]
- self.bounds = [-2, 2]
- self.translate_center(0, 0)
- self.iterations = self.program["iter"] = 300
-
- self.apply_zoom()
-
- self.min_scale = 1e-12
- self.max_scale = 4
-
- gloo.set_clear_color(color='black')
-
- self.show()
-
- def on_draw(self, event):
- self.program.draw()
-
- def on_resize(self, event):
- self.apply_zoom()
-
- def apply_zoom(self):
- width, height = self.physical_size
- gloo.set_viewport(0, 0, width, height)
- self.program['inv_resolution_x'] = set_emulated_double(1 / width)
- self.program['inv_resolution_y'] = set_emulated_double(1 / height)
-
- def on_mouse_move(self, event):
- """Pan the view based on the change in mouse position."""
- if event.is_dragging and event.buttons[0] == 1:
- x0, y0 = event.last_event.pos[0], event.last_event.pos[1]
- x1, y1 = event.pos[0], event.pos[1]
- X0, Y0 = self.pixel_to_coords(float(x0), float(y0))
- X1, Y1 = self.pixel_to_coords(float(x1), float(y1))
- self.translate_center(X1 - X0, Y1 - Y0)
- self.update()
-
- def translate_center(self, dx, dy):
- """Translates the center point, and keeps it in bounds."""
- center = self.center
- center[0] -= dx
- center[1] -= dy
- center[0] = min(max(center[0], self.bounds[0]), self.bounds[1])
- center[1] = min(max(center[1], self.bounds[0]), self.bounds[1])
- self.center = center
-
- center_x = set_emulated_double(center[0])
- center_y = set_emulated_double(center[1])
- self.program["center_x"] = center_x
- self.program["center_y"] = center_y
-
- def pixel_to_coords(self, x, y):
- """Convert pixel coordinates to Mandelbrot set coordinates."""
- rx, ry = self.size
- nx = (x / rx - 0.5) * self.scale + self.center[0]
- ny = ((ry - y) / ry - 0.5) * self.scale + self.center[1]
- return [nx, ny]
-
- def on_mouse_wheel(self, event):
- """Use the mouse wheel to zoom."""
- delta = event.delta[1]
- if delta > 0: # Zoom in
- factor = 0.9
- elif delta < 0: # Zoom out
- factor = 1 / 0.9
- for _ in range(int(abs(delta))):
- self.zoom(factor, event.pos)
- self.update()
-
- def on_key_press(self, event):
- """Use + or - to zoom in and out.
-
- The mouse wheel can be used to zoom, but some people don't have mouse
- wheels :)
-
- """
- if event.text == '+' or event.text == '=':
- self.zoom(0.9)
- elif event.text == '-':
- self.zoom(1/0.9)
- self.update()
-
- def zoom(self, factor, mouse_coords=None):
- """Factors less than zero zoom in, and greater than zero zoom out.
-
- If mouse_coords is given, the point under the mouse stays stationary
- while zooming. mouse_coords should come from MouseEvent.pos.
-
- """
- if mouse_coords is not None: # Record the position of the mouse
- x, y = float(mouse_coords[0]), float(mouse_coords[1])
- x0, y0 = self.pixel_to_coords(x, y)
-
- self.scale *= factor
- self.scale = max(min(self.scale, self.max_scale), self.min_scale)
- self.program["scale"] = set_emulated_double(self.scale)
-
- if mouse_coords is not None: # Translate so mouse point is stationary
- x1, y1 = self.pixel_to_coords(x, y)
- self.translate_center(x1 - x0, y1 - y0)
-
-
-def set_emulated_double(number):
- """Emulate a double using two numbers of type float32."""
- double = np.array([number, 0], dtype=np.float32) # Cast number to float32
- double[1] = number - double[0] # Remainder stored in second half of array
- return double
-
-
-if __name__ == '__main__':
- canvas = Canvas(size=(800, 800), keys='interactive')
- app.run()
diff --git a/examples/demo/gloo/molecular_viewer.py b/examples/demo/gloo/molecular_viewer.py
deleted file mode 100644
index 0a424b3..0000000
--- a/examples/demo/gloo/molecular_viewer.py
+++ /dev/null
@@ -1,195 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# 2014, Aurore Deschildre, Gael Goret, Cyrille Rossant, Nicolas P. Rougier.
-# Distributed under the terms of the new BSD License.
-# -----------------------------------------------------------------------------
-import numpy as np
-
-from vispy import gloo
-from vispy import app
-from vispy.util.transforms import perspective, translate, rotate
-from vispy.io import load_data_file
-
-vertex = """
-#version 120
-
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform vec3 u_light_position;
-uniform vec3 u_light_spec_position;
-
-attribute vec3 a_position;
-attribute vec3 a_color;
-attribute float a_radius;
-
-varying vec3 v_color;
-varying vec4 v_eye_position;
-varying float v_radius;
-varying vec3 v_light_direction;
-
-void main (void) {
- v_radius = a_radius;
- v_color = a_color;
-
- v_eye_position = u_view * u_model * vec4(a_position,1.0);
- v_light_direction = normalize(u_light_position);
- float dist = length(v_eye_position.xyz);
-
- gl_Position = u_projection * v_eye_position;
-
- // stackoverflow.com/questions/8608844/...
- // ... resizing-point-sprites-based-on-distance-from-the-camera
- vec4 proj_corner = u_projection * vec4(a_radius, a_radius, v_eye_position.z, v_eye_position.w); // # noqa
- gl_PointSize = 512.0 * proj_corner.x / proj_corner.w;
-}
-"""
-
-fragment = """
-#version 120
-
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform vec3 u_light_position;
-uniform vec3 u_light_spec_position;
-
-varying vec3 v_color;
-varying vec4 v_eye_position;
-varying float v_radius;
-varying vec3 v_light_direction;
-void main()
-{
- // r^2 = (x - x0)^2 + (y - y0)^2 + (z - z0)^2
- vec2 texcoord = gl_PointCoord* 2.0 - vec2(1.0);
- float x = texcoord.x;
- float y = texcoord.y;
- float d = 1.0 - x*x - y*y;
- if (d <= 0.0)
- discard;
-
- float z = sqrt(d);
- vec4 pos = v_eye_position;
- pos.z += v_radius*z;
- vec3 pos2 = pos.xyz;
- pos = u_projection * pos;
-// gl_FragDepth = 0.5*(pos.z / pos.w)+0.5;
- vec3 normal = vec3(x,y,z);
- float diffuse = clamp(dot(normal, v_light_direction), 0.0, 1.0);
-
- // Specular lighting.
- vec3 M = pos2.xyz;
- vec3 O = v_eye_position.xyz;
- vec3 L = u_light_spec_position;
- vec3 K = normalize(normalize(L - M) + normalize(O - M));
- // WARNING: abs() is necessary, otherwise weird bugs may appear with some
- // GPU drivers...
- float specular = clamp(pow(abs(dot(normal, K)), 40.), 0.0, 1.0);
- vec3 v_light = vec3(1., 1., 1.);
- gl_FragColor.rgb = (.15*v_color + .55*diffuse * v_color
- + .35*specular * v_light);
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, title='Molecular viewer',
- keys='interactive', size=(1200, 800))
- self.ps = self.pixel_scale
-
- self.translate = 40
- self.program = gloo.Program(vertex, fragment)
- self.view = translate((0, 0, -self.translate))
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
-
- self.apply_zoom()
-
- fname = load_data_file('molecular_viewer/micelle.npz')
- self.load_molecule(fname)
- self.load_data()
-
- self.theta = 0
- self.phi = 0
-
- gloo.set_state(depth_test=True, clear_color='black')
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def load_molecule(self, fname):
- molecule = np.load(fname)['molecule']
- self._nAtoms = molecule.shape[0]
-
- # The x,y,z values store in one array
- self.coords = molecule[:, :3]
-
- # The array that will store the color and alpha scale for all the atoms
- self.atomsColours = molecule[:, 3:6]
-
- # The array that will store the scale for all the atoms.
- self.atomsScales = molecule[:, 6]
-
- def load_data(self):
- n = self._nAtoms
-
- data = np.zeros(n, [('a_position', np.float32, 3),
- ('a_color', np.float32, 3),
- ('a_radius', np.float32, 1)])
-
- data['a_position'] = self.coords
- data['a_color'] = self.atomsColours
- data['a_radius'] = self.atomsScales*self.ps
-
- self.program.bind(gloo.VertexBuffer(data))
-
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
- self.program['u_light_position'] = 0., 0., 2.
- self.program['u_light_spec_position'] = -5., 5., -5.
-
- def on_key_press(self, event):
- if event.text == ' ':
- if self.timer.running:
- self.timer.stop()
- else:
- self.timer.start()
- # if event.text == 'A':
- # self.
-
- def on_timer(self, event):
- self.theta += .25
- self.phi += .25
- self.model = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.program['u_model'] = self.model
- self.update()
-
- def on_resize(self, event):
- width, height = event.size
-
- def apply_zoom(self):
- width, height = self.physical_size
- gloo.set_viewport(0, 0, width, height)
- self.projection = perspective(25.0, width / float(height), 2.0, 100.0)
- self.program['u_projection'] = self.projection
-
- def on_mouse_wheel(self, event):
- self.translate -= event.delta[1]
- self.translate = max(-1, self.translate)
- self.view = translate((0, 0, -self.translate))
-
- self.program['u_view'] = self.view
- self.update()
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('points')
-
-
-if __name__ == '__main__':
- mvc = Canvas()
- app.run()
diff --git a/examples/demo/gloo/ndscatter.py b/examples/demo/gloo/ndscatter.py
deleted file mode 100644
index 3fe51fc..0000000
--- a/examples/demo/gloo/ndscatter.py
+++ /dev/null
@@ -1,142 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-
-"""N-dimensional scatter plot with GPU-based projections.
-The projection axes evolve smoothly over time, following a path on the
-Lie group SO(n).
-"""
-
-from vispy import gloo
-from vispy import app
-from vispy.color import ColorArray
-from vispy.io import load_iris
-import numpy as np
-from scipy.linalg import logm
-
-VERT_SHADER = """
-#version 120
-attribute vec4 a_position;
-attribute vec3 a_color;
-attribute float a_size;
-
-uniform vec2 u_pan;
-uniform vec2 u_scale;
-uniform vec4 u_vec1;
-uniform vec4 u_vec2;
-
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_radius;
-varying float v_linewidth;
-varying float v_antialias;
-
-void main (void) {
- v_radius = a_size;
- v_linewidth = 1.0;
- v_antialias = 1.0;
- v_fg_color = vec4(0.0,0.0,0.0,0.5);
- v_bg_color = vec4(a_color, 1.0);
-
- vec2 position = vec2(dot(a_position, u_vec1),
- dot(a_position, u_vec2));
-
- vec2 position_tr = u_scale * (position + u_pan);
- gl_Position = vec4(position_tr, 0.0, 1.0);
- gl_PointSize = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);
-}
-"""
-
-FRAG_SHADER = """
-#version 120
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_radius;
-varying float v_linewidth;
-varying float v_antialias;
-void main()
-{
- float size = 2.0*(v_radius + v_linewidth + 1.5*v_antialias);
- float t = v_linewidth/2.0-v_antialias;
- float r = length((gl_PointCoord.xy - vec2(0.5,0.5))*size);
- float d = abs(r - v_radius) - t;
- if( d < 0.0 )
- gl_FragColor = v_fg_color;
- else
- {
- float alpha = d/v_antialias;
- alpha = exp(-alpha*alpha);
- if (r > v_radius)
- gl_FragColor = vec4(v_fg_color.rgb, alpha*v_fg_color.a);
- else
- gl_FragColor = mix(v_bg_color, v_fg_color, alpha);
- }
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, position=(50, 50), keys='interactive')
- ps = self.pixel_scale
-
- # Load the Iris dataset and normalize.
- iris = load_iris()
- position = iris['data'].astype(np.float32)
- n, ndim = position.shape
- position -= position.mean()
- position /= np.abs(position).max()
- v_position = position*.75
-
- v_color = ColorArray(['orange', 'magenta', 'darkblue'])
- v_color = v_color.rgb[iris['group'], :].astype(np.float32)
- v_color *= np.random.uniform(.5, 1.5, (n, 3))
- v_color = np.clip(v_color, 0, 1)
- v_size = np.random.uniform(2*ps, 12*ps, (n, 1)).astype(np.float32)
-
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
-
- self.program['a_position'] = gloo.VertexBuffer(v_position)
- self.program['a_color'] = gloo.VertexBuffer(v_color)
- self.program['a_size'] = gloo.VertexBuffer(v_size)
-
- self.program['u_pan'] = (0., 0.)
- self.program['u_scale'] = (1., 1.)
-
- self.program['u_vec1'] = (1., 0., 0., 0.)
- self.program['u_vec2'] = (0., 1., 0., 0.)
-
- # Circulant matrix.
- circ = np.diagflat(np.ones(ndim-1), 1)
- circ[-1, 0] = -1 if ndim % 2 == 0 else 1
- self.logcirc = logm(circ)
- # We will solve the equation dX/dt = log(circ) * X in real time
- # to compute the matrix exponential expm(t*log(circ)).
- self.mat = np.eye(ndim)
- self.dt = .001
- gloo.set_state(clear_color=(1, 1, 1, 1), blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
- gloo.set_viewport(0, 0, *self.physical_size)
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
- self.show()
-
- def on_timer(self, event):
- # We advance the numerical solver from as many dt there have been
- # since the last update.
- for t in np.arange(0., event.dt, self.dt):
- self.mat += self.dt * np.dot(self.logcirc, self.mat).real
- # We just keep the first two columns of the matrix.
- self.program['u_vec1'] = self.mat[:, 0].squeeze()
- self.program['u_vec2'] = self.mat[:, 1].squeeze()
- self.update()
-
- def on_resize(self, event):
- gloo.set_viewport(0, 0, *event.physical_size)
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('points')
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/offscreen.py b/examples/demo/gloo/offscreen.py
deleted file mode 100644
index b968921..0000000
--- a/examples/demo/gloo/offscreen.py
+++ /dev/null
@@ -1,146 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-Demonstrate how to do offscreen rendering.
-Possible use cases:
-
- * GPGPU without CUDA or OpenCL
- * creation of scripted animations
- * remote and Web backends
-
-The method consists of:
-
- 1. Not showing the canvas (show=False).
- 2. Rendering to an FBO.
- 3. Manually triggering a rendering pass with self.update().
- 4. Retrieving the scene with _screenshot().
- 5. Closing the app after the first rendering pass (if that's the intended
- scenario).
-
-"""
-
-from vispy import gloo
-from vispy import app
-from vispy.util.ptime import time
-from vispy.gloo.util import _screenshot
-
-# WARNING: doesn't work with Qt4 (update() does not call on_draw()??)
-app.use_app('glfw')
-
-vertex = """
-attribute vec2 position;
-
-void main()
-{
- gl_Position = vec4(position, 0, 1.0);
-}
-"""
-
-fragment = """
-uniform vec2 resolution;
-uniform vec2 center;
-uniform float scale;
-uniform int iter;
-
-// Jet color scheme
-vec4 color_scheme(float x) {
- vec3 a, b;
- float c;
- if (x < 0.34) {
- a = vec3(0, 0, 0.5);
- b = vec3(0, 0.8, 0.95);
- c = (x - 0.0) / (0.34 - 0.0);
- } else if (x < 0.64) {
- a = vec3(0, 0.8, 0.95);
- b = vec3(0.85, 1, 0.04);
- c = (x - 0.34) / (0.64 - 0.34);
- } else if (x < 0.89) {
- a = vec3(0.85, 1, 0.04);
- b = vec3(0.96, 0.7, 0);
- c = (x - 0.64) / (0.89 - 0.64);
- } else {
- a = vec3(0.96, 0.7, 0);
- b = vec3(0.5, 0, 0);
- c = (x - 0.89) / (1.0 - 0.89);
- }
- return vec4(mix(a, b, c), 1.0);
-}
-
-void main() {
- vec2 z, c;
-
- // Recover coordinates from pixel coordinates
- c.x = (gl_FragCoord.x / resolution.x - 0.5) * scale + center.x;
- c.y = (gl_FragCoord.y / resolution.y - 0.5) * scale + center.y;
-
- // Main Mandelbrot computation
- int i;
- z = c;
- for(i = 0; i < iter; i++) {
- float x = (z.x * z.x - z.y * z.y) + c.x;
- float y = (z.y * z.x + z.x * z.y) + c.y;
-
- if((x * x + y * y) > 4.0) break;
- z.x = x;
- z.y = y;
- }
-
- // Convert iterations to color
- float color = 1.0 - float(i) / float(iter);
- gl_FragColor = color_scheme(color);
-
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self, size=(600, 600)):
- # We hide the canvas upon creation.
- app.Canvas.__init__(self, show=False, size=size)
- self._t0 = time()
- # Texture where we render the scene.
- self._rendertex = gloo.Texture2D(self.size)
- # FBO.
- self._fbo = gloo.FrameBuffer(self._rendertex,
- gloo.RenderBuffer(self.size))
- # Regular program that will be rendered to the FBO.
- self.program = gloo.Program(vertex, fragment)
- self.program["position"] = [(-1, -1), (-1, 1), (1, 1),
- (-1, -1), (1, 1), (1, -1)]
- self.program["scale"] = 3
- self.program["center"] = [-0.5, 0]
- self.program["iter"] = 300
- self.program['resolution'] = self.size
- # We manually draw the hidden canvas.
- self.update()
-
- def on_draw(self, event):
- # Render in the FBO.
- with self._fbo:
- gloo.clear('black')
- gloo.set_viewport(0, 0, *self.size)
- self.program.draw()
- # Retrieve the contents of the FBO texture.
- self.im = _screenshot((0, 0, self.size[0], self.size[1]))
- self._time = time() - self._t0
- # Immediately exit the application.
- app.quit()
-
-if __name__ == '__main__':
- c = Canvas()
- size = c.size
- app.run()
-
- # The rendering is done, we get the rendering output (4D NumPy array)
- render = c.im
- print('Finished in %.1fms.' % (c._time*1e3))
-
- # Now, we display this image with matplotlib to check.
- import matplotlib.pyplot as plt
- plt.figure(figsize=(size[0]/100., size[1]/100.), dpi=100)
- plt.imshow(render, interpolation='none')
- plt.show()
diff --git a/examples/demo/gloo/primitive_mesh_viewer_qt.py b/examples/demo/gloo/primitive_mesh_viewer_qt.py
deleted file mode 100644
index 416b875..0000000
--- a/examples/demo/gloo/primitive_mesh_viewer_qt.py
+++ /dev/null
@@ -1,378 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Abstract: show mesh primitive
-# Keywords: cone, arrow, sphere, cylinder, qt
-# -----------------------------------------------------------------------------
-
-"""
-Test the fps capability of Vispy with meshdata primitive
-"""
-try:
- from sip import setapi
- setapi("QVariant", 2)
- setapi("QString", 2)
-except ImportError:
- pass
-
-from PyQt4 import QtGui, QtCore
-import sys
-
-import numpy as np
-from vispy import app, gloo
-from vispy.util.transforms import perspective, translate, rotate
-from vispy.geometry import meshdata as md
-from vispy.geometry import generation as gen
-
-OBJECT = {'sphere': [('rows', 3, 1000, 'int', 3),
- ('cols', 3, 1000, 'int', 3),
- ('radius', 0.1, 10, 'double', 1.0)],
- 'cylinder': [('rows', 4, 1000, 'int', 4),
- ('cols', 4, 1000, 'int', 4),
- ('radius', 0.1, 10, 'double', 1.0),
- ('radius Top.', 0.1, 10, 'double', 1.0),
- ('length', 0.1, 10, 'double', 1.0)],
- 'cone': [('cols', 3, 1000, 'int', 3),
- ('radius', 0.1, 10, 'double', 1.0),
- ('length', 0.1, 10, 'double', 1.0)],
- 'arrow': [('rows', 4, 1000, 'int', 4),
- ('cols', 4, 1000, 'int', 4),
- ('radius', 0.01, 10, 'double', 0.1),
- ('length', 0.1, 10, 'double', 1.0),
- ('cone_radius', 0.1, 10, 'double', 0.2),
- ('cone_length', 0.0, 10., 'double', 0.3)]}
-
-vert = """
-// Uniforms
-// ------------------------------------
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform vec4 u_color;
-
-// Attributes
-// ------------------------------------
-attribute vec3 a_position;
-attribute vec3 a_normal;
-attribute vec4 a_color;
-
-// Varying
-// ------------------------------------
-varying vec4 v_color;
-
-void main()
-{
- v_color = a_color * u_color;
- gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);
-}
-"""
-
-
-frag = """
-// Varying
-// ------------------------------------
-varying vec4 v_color;
-
-void main()
-{
- gl_FragColor = v_color;
-}
-"""
-
-DEFAULT_COLOR = (0, 1, 1, 1)
-# -----------------------------------------------------------------------------
-
-
-class MyMeshData(md.MeshData):
- """ Add to Meshdata class the capability to export good data for gloo """
- def __init__(self, vertices=None, faces=None, edges=None,
- vertex_colors=None, face_colors=None):
- md.MeshData.__init__(self, vertices=None, faces=None, edges=None,
- vertex_colors=None, face_colors=None)
-
- def get_glTriangles(self):
- """
- Build vertices for a colored mesh.
- V is the vertices
- I1 is the indices for a filled mesh (use with GL_TRIANGLES)
- I2 is the indices for an outline mesh (use with GL_LINES)
- """
- vtype = [('a_position', np.float32, 3),
- ('a_normal', np.float32, 3),
- ('a_color', np.float32, 4)]
- vertices = self.get_vertices()
- normals = self.get_vertex_normals()
- faces = np.uint32(self.get_faces())
-
- edges = np.uint32(self.get_edges().reshape((-1)))
- colors = self.get_vertex_colors()
-
- nbrVerts = vertices.shape[0]
- V = np.zeros(nbrVerts, dtype=vtype)
- V[:]['a_position'] = vertices
- V[:]['a_normal'] = normals
- V[:]['a_color'] = colors
-
- return V, faces.reshape((-1)), edges.reshape((-1))
-# -----------------------------------------------------------------------------
-
-
-class ObjectParam(object):
- """
- OBJECT parameter test
- """
- def __init__(self, name, list_param):
- self.name = name
- self.list_param = list_param
- self.props = {}
- self.props['visible'] = True
- for nameV, minV, maxV, typeV, iniV in list_param:
- self.props[nameV] = iniV
-# -----------------------------------------------------------------------------
-
-
-class ObjectWidget(QtGui.QWidget):
- """
- Widget for editing OBJECT parameters
- """
- signal_objet_changed = QtCore.pyqtSignal(ObjectParam, name='objectChanged')
-
- def __init__(self, parent=None, param=None):
- super(ObjectWidget, self).__init__(parent)
-
- if param is None:
- self.param = ObjectParam('sphere', OBJECT['sphere'])
- else:
- self.param = param
-
- self.gb_c = QtGui.QGroupBox(u"Hide/Show %s" % self.param.name)
- self.gb_c.setCheckable(True)
- self.gb_c.setChecked(self.param.props['visible'])
- self.gb_c.toggled.connect(self.update_param)
-
- lL = []
- self.sp = []
- gb_c_lay = QtGui.QGridLayout()
- for nameV, minV, maxV, typeV, iniV in self.param.list_param:
- lL.append(QtGui.QLabel(nameV, self.gb_c))
- if typeV == 'double':
- self.sp.append(QtGui.QDoubleSpinBox(self.gb_c))
- self.sp[-1].setDecimals(2)
- self.sp[-1].setSingleStep(0.1)
- self.sp[-1].setLocale(QtCore.QLocale(QtCore.QLocale.English))
- elif typeV == 'int':
- self.sp.append(QtGui.QSpinBox(self.gb_c))
- self.sp[-1].setMinimum(minV)
- self.sp[-1].setMaximum(maxV)
- self.sp[-1].setValue(iniV)
-
- # Layout
- for pos in range(len(lL)):
- gb_c_lay.addWidget(lL[pos], pos, 0)
- gb_c_lay.addWidget(self.sp[pos], pos, 1)
- # Signal
- self.sp[pos].valueChanged.connect(self.update_param)
-
- self.gb_c.setLayout(gb_c_lay)
-
- vbox = QtGui.QVBoxLayout()
- hbox = QtGui.QHBoxLayout()
- hbox.addWidget(self.gb_c)
- hbox.addStretch(1.0)
- vbox.addLayout(hbox)
- vbox.addStretch(1.0)
-
- self.setLayout(vbox)
-
- def update_param(self, option):
- """
- update param and emit a signal
- """
- self.param.props['visible'] = self.gb_c.isChecked()
- keys = map(lambda x: x[0], self.param.list_param)
- for pos, nameV in enumerate(keys):
- self.param.props[nameV] = self.sp[pos].value()
- # emit signal
- self.signal_objet_changed.emit(self.param)
-# -----------------------------------------------------------------------------
-
-
-class Canvas(app.Canvas):
-
- def __init__(self,):
- app.Canvas.__init__(self)
- self.size = 800, 600
- # fovy, zfar params
- self.fovy = 45.0
- self.zfar = 10.0
- width, height = self.size
- self.aspect = width / float(height)
-
- self.program = gloo.Program(vert, frag)
-
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
- self.view = translate((0, 0, -5.0))
-
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
-
- self.theta = 0
- self.phi = 0
- self.visible = True
-
- self._timer = app.Timer(1.0 / 60)
- self._timer.connect(self.on_timer)
- self._timer.start()
-
- # ---------------------------------
- gloo.set_clear_color((1, 1, 1, 1))
- gloo.set_state('opaque')
- gloo.set_polygon_offset(1, 1)
-
- # ---------------------------------
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- self.model = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.program['u_model'] = self.model
- self.update()
-
- # ---------------------------------
- def on_resize(self, event):
- width, height = event.size
- self.size = event.size
- gloo.set_viewport(0, 0, width, height)
- self.aspect = width / float(height)
- self.projection = perspective(self.fovy, width / float(height), 1.0,
- self.zfar)
- self.program['u_projection'] = self.projection
-
- # ---------------------------------
- def on_draw(self, event):
- gloo.clear()
- if self.visible:
- # Filled mesh
- gloo.set_state(blend=False, depth_test=True,
- polygon_offset_fill=True)
- self.program['u_color'] = 1, 1, 1, 1
- self.program.draw('triangles', self.filled_buf)
-
- # Outline
- gloo.set_state(blend=True, depth_test=True,
- polygon_offset_fill=False)
- gloo.set_depth_mask(False)
- self.program['u_color'] = 0, 0, 0, 1
- self.program.draw('lines', self.outline_buf)
- gloo.set_depth_mask(True)
-
- # ---------------------------------
- def set_data(self, vertices, filled, outline):
- self.filled_buf = gloo.IndexBuffer(filled)
- self.outline_buf = gloo.IndexBuffer(outline)
- self.vertices_buff = gloo.VertexBuffer(vertices)
- self.program.bind(self.vertices_buff)
- self.update()
-# -----------------------------------------------------------------------------
-
-
-class MainWindow(QtGui.QMainWindow):
-
- def __init__(self):
- QtGui.QMainWindow.__init__(self)
-
- self.resize(700, 500)
- self.setWindowTitle('vispy example ...')
-
- self.list_object = QtGui.QListWidget()
- self.list_object.setAlternatingRowColors(True)
- self.list_object.itemSelectionChanged.connect(self.list_objectChanged)
-
- self.list_object.addItems(list(OBJECT.keys()))
- self.props_widget = ObjectWidget(self)
- self.props_widget.signal_objet_changed.connect(self.update_view)
-
- self.splitter_v = QtGui.QSplitter(QtCore.Qt.Vertical)
- self.splitter_v.addWidget(self.list_object)
- self.splitter_v.addWidget(self.props_widget)
-
- self.canvas = Canvas()
- self.canvas.create_native()
- self.canvas.native.setParent(self)
- self.canvas.measure_fps(0.1, self.show_fps)
-
- # Central Widget
- splitter1 = QtGui.QSplitter(QtCore.Qt.Horizontal)
- splitter1.addWidget(self.splitter_v)
- splitter1.addWidget(self.canvas.native)
-
- self.setCentralWidget(splitter1)
-
- # FPS message in statusbar:
- self.status = self.statusBar()
- self.status.showMessage("...")
-
- self.mesh = MyMeshData()
- self.update_view(self.props_widget.param)
-
- def list_objectChanged(self):
- row = self.list_object.currentIndex().row()
- name = self.list_object.currentIndex().data()
- if row != -1:
- self.props_widget.deleteLater()
- self.props_widget = ObjectWidget(self, param=ObjectParam(name,
- OBJECT[name]))
- self.splitter_v.addWidget(self.props_widget)
- self.props_widget.signal_objet_changed.connect(self.update_view)
- self.update_view(self.props_widget.param)
-
- def show_fps(self, fps):
- nbr_tri = self.mesh.n_faces
- self.status.showMessage("FPS - %.2f and nbr Tri %s " % (fps, nbr_tri))
-
- def update_view(self, param):
- cols = param.props['cols']
- radius = param.props['radius']
- if param.name == 'sphere':
- rows = param.props['rows']
- mesh = gen.create_sphere(cols, rows, radius=radius)
- elif param.name == 'cone':
- length = param.props['length']
- mesh = gen.create_cone(cols, radius=radius, length=length)
- elif param.name == 'cylinder':
- rows = param.props['rows']
- length = param.props['length']
- radius2 = param.props['radius Top.']
- mesh = gen.create_cylinder(rows, cols, radius=[radius, radius2],
- length=length)
- elif param.name == 'arrow':
- length = param.props['length']
- rows = param.props['rows']
- cone_radius = param.props['cone_radius']
- cone_length = param.props['cone_length']
- mesh = gen.create_arrow(rows, cols, radius=radius, length=length,
- cone_radius=cone_radius,
- cone_length=cone_length)
- else:
- return
-
- self.canvas.visible = param.props['visible']
- self.mesh.set_vertices(mesh.get_vertices())
- self.mesh.set_faces(mesh.get_faces())
- colors = np.tile(DEFAULT_COLOR, (self.mesh.n_vertices, 1))
- self.mesh.set_vertex_colors(colors)
- vertices, filled, outline = self.mesh.get_glTriangles()
- self.canvas.set_data(vertices, filled, outline)
-
-# Start Qt event loop unless running in interactive mode.
-if __name__ == '__main__':
-
- appQt = QtGui.QApplication(sys.argv)
- win = MainWindow()
- win.show()
- appQt.exec_()
diff --git a/examples/demo/gloo/quiver.py b/examples/demo/gloo/quiver.py
deleted file mode 100644
index dfc424d..0000000
--- a/examples/demo/gloo/quiver.py
+++ /dev/null
@@ -1,292 +0,0 @@
-#! /usr/bin/env python
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2014, Nicolas P. Rougier. All Rights Reserved.
-# Distributed under the (new) BSD License.
-# -----------------------------------------------------------------------------
-
-from vispy import app, gloo
-
-
-vertex = """
-attribute vec2 position;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0);
-}
-"""
-
-fragment = """
-
-vec4 stroke(float distance, float linewidth, float antialias, vec4 stroke)
-{
- vec4 frag_color;
- float t = linewidth/2.0 - antialias;
- float signed_distance = distance;
- float border_distance = abs(signed_distance) - t;
- float alpha = border_distance/antialias;
- alpha = exp(-alpha*alpha);
- if( border_distance > (linewidth/2.0 + antialias) )
- discard;
- else if( border_distance < 0.0 )
- frag_color = stroke;
- else
- frag_color = vec4(stroke.rgb, stroke.a * alpha);
- return frag_color;
-}
-
-vec4 filled(float distance, float linewidth, float antialias, vec4 fill)
-{
- vec4 frag_color;
- float t = linewidth/2.0 - antialias;
- float signed_distance = distance;
- float border_distance = abs(signed_distance) - t;
- float alpha = border_distance/antialias;
- alpha = exp(-alpha*alpha);
- // Within linestroke
- if( border_distance < 0.0 )
- frag_color = fill;
- // Within shape
- else if( signed_distance < 0.0 )
- frag_color = fill;
- else
- // Outside shape
- if( border_distance > (linewidth/2.0 + antialias) )
- discard;
- else // Line stroke exterior border
- frag_color = vec4(fill.rgb, alpha * fill.a);
- return frag_color;
-}
-
-// Computes the signed distance from a line
-float line_distance(vec2 p, vec2 p1, vec2 p2) {
- vec2 center = (p1 + p2) * 0.5;
- float len = length(p2 - p1);
- vec2 dir = (p2 - p1) / len;
- vec2 rel_p = p - center;
- return dot(rel_p, vec2(dir.y, -dir.x));
-}
-
-// Computes the signed distance from a line segment
-float segment_distance(vec2 p, vec2 p1, vec2 p2) {
- vec2 center = (p1 + p2) * 0.5;
- float len = length(p2 - p1);
- vec2 dir = (p2 - p1) / len;
- vec2 rel_p = p - center;
- float dist1 = abs(dot(rel_p, vec2(dir.y, -dir.x)));
- float dist2 = abs(dot(rel_p, dir)) - 0.5*len;
- return max(dist1, dist2);
-}
-
-// Computes the center with given radius passing through p1 & p2
-vec4 circle_from_2_points(vec2 p1, vec2 p2, float radius)
-{
- float q = length(p2-p1);
- vec2 m = (p1+p2)/2.0;
- vec2 d = vec2( sqrt(radius*radius - (q*q/4.0)) * (p1.y-p2.y)/q,
- sqrt(radius*radius - (q*q/4.0)) * (p2.x-p1.x)/q);
- return vec4(m+d, m-d);
-}
-
-float arrow_curved(vec2 texcoord,
- float body, float head,
- float linewidth, float antialias)
-{
- float w = linewidth/2.0 + antialias;
- vec2 start = -vec2(body/2.0, 0.0);
- vec2 end = +vec2(body/2.0, 0.0);
- float height = 0.5;
- vec2 p1 = end - head*vec2(+1.0,+height);
- vec2 p2 = end - head*vec2(+1.0,-height);
- vec2 p3 = end;
- // Head : 3 circles
- vec2 c1 = circle_from_2_points(p1, p3, 1.25*body).zw;
- float d1 = length(texcoord - c1) - 1.25*body;
- vec2 c2 = circle_from_2_points(p2, p3, 1.25*body).xy;
- float d2 = length(texcoord - c2) - 1.25*body;
- vec2 c3 = circle_from_2_points(p1, p2, max(body-head, 1.0*body)).xy;
- float d3 = length(texcoord - c3) - max(body-head, 1.0*body);
- // Body : 1 segment
- float d4 = segment_distance(texcoord, start, end - vec2(linewidth,0.0));
- // Outside (because of circles)
- if( texcoord.y > +(2.0*head + antialias) )
- return 1000.0;
- if( texcoord.y < -(2.0*head + antialias) )
- return 1000.0;
- if( texcoord.x < -(body/2.0 + antialias) )
- return 1000.0;
- if( texcoord.x > c1.x ) //(body + antialias) )
- return 1000.0;
- return min( d4, -min(d3,min(d1,d2)));
-}
-
-float arrow_triangle(vec2 texcoord,
- float body, float head, float height,
- float linewidth, float antialias)
-{
- float w = linewidth/2.0 + antialias;
- vec2 start = -vec2(body/2.0, 0.0);
- vec2 end = +vec2(body/2.0, 0.0);
- // Head : 3 lines
- float d1 = line_distance(texcoord, end, end - head*vec2(+1.0,-height));
- float d2 = line_distance(texcoord, end - head*vec2(+1.0,+height), end);
- float d3 = texcoord.x - end.x + head;
- // Body : 1 segment
- float d4 = segment_distance(texcoord, start, end - vec2(linewidth,0.0));
- float d = min(max(max(d1, d2), -d3), d4);
- return d;
-}
-
-float arrow_triangle_90(vec2 texcoord,
- float body, float head,
- float linewidth, float antialias)
-{
- return arrow_triangle(texcoord, body, head, 1.0, linewidth, antialias);
-}
-
-float arrow_triangle_60(vec2 texcoord,
- float body, float head,
- float linewidth, float antialias)
-{
- return arrow_triangle(texcoord, body, head, 0.5, linewidth, antialias);
-}
-
-float arrow_triangle_30(vec2 texcoord,
- float body, float head,
- float linewidth, float antialias)
-{
- return arrow_triangle(texcoord, body, head, 0.25, linewidth, antialias);
-}
-
-float arrow_angle(vec2 texcoord,
- float body, float head, float height,
- float linewidth, float antialias)
-{
- float d;
- float w = linewidth/2.0 + antialias;
- vec2 start = -vec2(body/2.0, 0.0);
- vec2 end = +vec2(body/2.0, 0.0);
- // Arrow tip (beyond segment end)
- if( texcoord.x > body/2.0) {
- // Head : 2 segments
- float d1 = line_distance(texcoord, end, end - head*vec2(+1.0,-height));
- float d2 = line_distance(texcoord, end - head*vec2(+1.0,+height), end);
- // Body : 1 segment
- float d3 = end.x - texcoord.x;
- d = max(max(d1,d2), d3);
- } else {
- // Head : 2 segments
- float d1 = segment_distance(texcoord,
- end - head*vec2(+1.0,-height), end);
- float d2 = segment_distance(texcoord,
- end - head*vec2(+1.0,+height), end);
- // Body : 1 segment
- float d3 = segment_distance(texcoord, start,
- end - vec2(linewidth,0.0));
- d = min(min(d1,d2), d3);
- }
- return d;
-}
-
-float arrow_angle_90(vec2 texcoord,
- float body, float head,
- float linewidth, float antialias)
-{
- return arrow_angle(texcoord, body, head, 1.0, linewidth, antialias);
-}
-
-float arrow_angle_60(vec2 texcoord,
- float body, float head,
- float linewidth, float antialias)
-{
- return arrow_angle(texcoord, body, head, 0.5, linewidth, antialias);
-}
-
-float arrow_angle_30(vec2 texcoord,
- float body, float head,
- float linewidth, float antialias)
-{
- return arrow_angle(texcoord, body, head, 0.25, linewidth, antialias);
-}
-
-float arrow_stealth(vec2 texcoord,
- float body, float head,
- float linewidth, float antialias)
-{
- float w = linewidth/2.0 + antialias;
- vec2 start = -vec2(body/2.0, 0.0);
- vec2 end = +vec2(body/2.0, 0.0);
- float height = 0.5;
- // Head : 4 lines
- float d1 = line_distance(texcoord, end-head*vec2(+1.0,-height),
- end);
- float d2 = line_distance(texcoord, end-head*vec2(+1.0,-height),
- end-vec2(3.0*head/4.0,0.0));
- float d3 = line_distance(texcoord, end-head*vec2(+1.0,+height), end);
- float d4 = line_distance(texcoord, end-head*vec2(+1.0,+0.5),
- end-vec2(3.0*head/4.0,0.0));
- // Body : 1 segment
- float d5 = segment_distance(texcoord, start, end - vec2(linewidth,0.0));
- return min(d5, max( max(-d1, d3), - max(-d2,d4)));
-}
-
-uniform vec2 iResolution;
-uniform vec2 iMouse;
-void main()
-{
- const float M_PI = 3.14159265358979323846;
- const float SQRT_2 = 1.4142135623730951;
- const float linewidth = 3.0;
- const float antialias = 1.0;
- const float rows = 32.0;
- const float cols = 32.0;
-
- float body = min(iResolution.x/cols, iResolution.y/rows) / SQRT_2;
- vec2 texcoord = gl_FragCoord.xy;
- vec2 size = iResolution.xy / vec2(cols,rows);
- vec2 center = (floor(texcoord/size) + vec2(0.5,0.5)) * size;
- texcoord -= center;
- float theta = M_PI-atan(center.y-iMouse.y, center.x-iMouse.x);
- float cos_theta = cos(theta);
- float sin_theta = sin(theta);
-
-
- texcoord = vec2(cos_theta*texcoord.x - sin_theta*texcoord.y,
- sin_theta*texcoord.x + cos_theta*texcoord.y);
-
- float d = arrow_stealth(texcoord, body, 0.25*body, linewidth, antialias);
- gl_FragColor = filled(d, linewidth, antialias, vec4(0,0,0,1));
-}
-"""
-
-
-canvas = app.Canvas(size=(2*512, 2*512), keys='interactive')
-
-
- at canvas.connect
-def on_draw(event):
- gloo.clear('white')
- program.draw('triangle_strip')
-
-
- at canvas.connect
-def on_resize(event):
- program["iResolution"] = event.size
- gloo.set_viewport(0, 0, event.size[0], event.size[1])
-
-
- at canvas.connect
-def on_mouse_move(event):
- x, y = event.pos
- program["iMouse"] = x, canvas.size[1] - y
- canvas.update()
-
-
-program = gloo.Program(vertex, fragment, count=4)
-dx, dy = 1, 1
-program['position'] = (-dx, -dy), (-dx, +dy), (+dx, -dy), (+dx, +dy)
-program["iMouse"] = (0., 0.)
-
-if __name__ == '__main__':
- canvas.show()
- app.run()
diff --git a/examples/demo/gloo/rain.py b/examples/demo/gloo/rain.py
deleted file mode 100755
index 52f0bb6..0000000
--- a/examples/demo/gloo/rain.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 06/03/2014
-# Abstract: Water ripple effect following mouse
-# Keywords: antialias, water, mouse
-# -----------------------------------------------------------------------------
-
-import numpy as np
-
-from vispy import gloo, app
-from vispy.gloo import Program, VertexBuffer
-from vispy.util.transforms import ortho
-
-vertex = """
-#version 120
-
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform float u_linewidth;
-uniform float u_antialias;
-
-attribute vec3 a_position;
-attribute vec4 a_fg_color;
-attribute float a_size;
-
-varying vec4 v_fg_color;
-varying float v_size;
-
-void main (void)
-{
- v_size = a_size;
- v_fg_color = a_fg_color;
- if( a_fg_color.a > 0.0)
- {
- gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);
- gl_PointSize = v_size + u_linewidth + 2*1.5*u_antialias;
- }
- else
- {
- gl_Position = u_projection * u_view * u_model * vec4(-1,-1,0,1);
- gl_PointSize = 0.0;
- }
-}
-"""
-
-fragment = """
-#version 120
-
-uniform float u_linewidth;
-uniform float u_antialias;
-varying vec4 v_fg_color;
-varying vec4 v_bg_color;
-varying float v_size;
-float disc(vec2 P, float size)
-{
- return length((P.xy - vec2(0.5,0.5))*size);
-}
-void main()
-{
- if( v_fg_color.a <= 0.0)
- discard;
- float actual_size = v_size + u_linewidth + 2*1.5*u_antialias;
- float t = u_linewidth/2.0 - u_antialias;
- float r = disc(gl_PointCoord, actual_size);
- float d = abs(r - v_size/2.0) - t;
- if( d < 0.0 )
- {
- gl_FragColor = v_fg_color;
- }
- else if( abs(d) > 2.5*u_antialias )
- {
- discard;
- }
- else
- {
- d /= u_antialias;
- gl_FragColor = vec4(v_fg_color.rgb, exp(-d*d)*v_fg_color.a);
- }
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, title='Rain [Move mouse]',
- size=(512, 512), keys='interactive')
-
- # Build data
- # --------------------------------------
- n = 500
- self.data = np.zeros(n, [('a_position', np.float32, 2),
- ('a_fg_color', np.float32, 4),
- ('a_size', np.float32, 1)])
- self.index = 0
- self.program = Program(vertex, fragment)
- self.vdata = VertexBuffer(self.data)
- self.program.bind(self.vdata)
- self.program['u_antialias'] = 1.00
- self.program['u_linewidth'] = 1.00
- self.program['u_model'] = np.eye(4, dtype=np.float32)
- self.program['u_view'] = np.eye(4, dtype=np.float32)
-
- self.activate_zoom()
-
- gloo.set_clear_color('white')
- gloo.set_state(blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
- self.timer = app.Timer('auto', self.on_timer, start=True)
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('points')
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- gloo.set_viewport(0, 0, *self.physical_size)
- projection = ortho(0, self.size[0], 0,
- self.size[1], -1, +1)
- self.program['u_projection'] = projection
-
- def on_timer(self, event):
- self.data['a_fg_color'][..., 3] -= 0.01
- self.data['a_size'] += 1.0
- self.vdata.set_data(self.data)
- self.update()
-
- def on_mouse_move(self, event):
- x, y = event.pos
- h = self.size[1]
- self.data['a_position'][self.index] = x, h - y
- self.data['a_size'][self.index] = 5
- self.data['a_fg_color'][self.index] = 0, 0, 0, 1
- self.index = (self.index + 1) % 500
-
-
-if __name__ == '__main__':
- canvas = Canvas()
- app.run()
diff --git a/examples/demo/gloo/raytracing.py b/examples/demo/gloo/raytracing.py
deleted file mode 100644
index 0055789..0000000
--- a/examples/demo/gloo/raytracing.py
+++ /dev/null
@@ -1,258 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 300
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-
-"""
-GPU-based ray tracing example.
-
-GLSL port of the following Python example:
- https://gist.github.com/rossant/6046463
- https://pbs.twimg.com/media/BPpbJTiCIAEoEPl.png
-
-TODO:
- * Once uniform structs are supported, refactor the code to encapsulate
- objects (spheres, planes, lights) in structures.
- * Customizable engine with an arbitrary number of objects.
-"""
-
-from math import cos
-from vispy import app, gloo
-
-vertex = """
-#version 120
-
-attribute vec2 a_position;
-varying vec2 v_position;
-void main()
-{
- gl_Position = vec4(a_position, 0.0, 1.0);
- v_position = a_position;
-}
-"""
-
-fragment = """
-#version 120
-
-const float M_PI = 3.14159265358979323846;
-const float INFINITY = 1000000000.;
-const int PLANE = 1;
-const int SPHERE_0 = 2;
-const int SPHERE_1 = 3;
-
-uniform float u_aspect_ratio;
-varying vec2 v_position;
-
-uniform vec3 sphere_position_0;
-uniform float sphere_radius_0;
-uniform vec3 sphere_color_0;
-
-uniform vec3 sphere_position_1;
-uniform float sphere_radius_1;
-uniform vec3 sphere_color_1;
-
-uniform vec3 plane_position;
-uniform vec3 plane_normal;
-
-uniform float light_intensity;
-uniform vec2 light_specular;
-uniform vec3 light_position;
-uniform vec3 light_color;
-
-uniform float ambient;
-uniform vec3 O;
-
-float intersect_sphere(vec3 O, vec3 D, vec3 S, float R) {
- float a = dot(D, D);
- vec3 OS = O - S;
- float b = 2. * dot(D, OS);
- float c = dot(OS, OS) - R * R;
- float disc = b * b - 4. * a * c;
- if (disc > 0.) {
- float distSqrt = sqrt(disc);
- float q = (-b - distSqrt) / 2.0;
- if (b >= 0.) {
- q = (-b + distSqrt) / 2.0;
- }
- float t0 = q / a;
- float t1 = c / q;
- t0 = min(t0, t1);
- t1 = max(t0, t1);
- if (t1 >= 0.) {
- if (t0 < 0.) {
- return t1;
- }
- else {
- return t0;
- }
- }
- }
- return INFINITY;
-}
-
-float intersect_plane(vec3 O, vec3 D, vec3 P, vec3 N) {
- float denom = dot(D, N);
- if (abs(denom) < 1e-6) {
- return INFINITY;
- }
- float d = dot(P - O, N) / denom;
- if (d < 0.) {
- return INFINITY;
- }
- return d;
-}
-
-vec3 run(float x, float y) {
- vec3 Q = vec3(x, y, 0.);
- vec3 D = normalize(Q - O);
- int depth = 0;
- float t_plane, t0, t1;
- vec3 rayO = O;
- vec3 rayD = D;
- vec3 col = vec3(0.0, 0.0, 0.0);
- vec3 col_ray;
- float reflection = 1.;
-
- int object_index;
- vec3 object_color;
- vec3 object_normal;
- float object_reflection;
- vec3 M;
- vec3 N, toL, toO;
-
- while (depth < 5) {
-
- /* start trace_ray */
-
- t_plane = intersect_plane(rayO, rayD, plane_position, plane_normal);
- t0 = intersect_sphere(rayO, rayD, sphere_position_0, sphere_radius_0);
- t1 = intersect_sphere(rayO, rayD, sphere_position_1, sphere_radius_1);
-
- if (t_plane < min(t0, t1)) {
- // Plane.
- M = rayO + rayD * t_plane;
- object_normal = plane_normal;
- // Plane texture.
- if (mod(int(2*M.x), 2) == mod(int(2*M.z), 2)) {
- object_color = vec3(1., 1., 1.);
- }
- else {
- object_color = vec3(0., 0., 0.);
- }
- object_reflection = .25;
- object_index = PLANE;
- }
- else if (t0 < t1) {
- // Sphere 0.
- M = rayO + rayD * t0;
- object_normal = normalize(M - sphere_position_0);
- object_color = sphere_color_0;
- object_reflection = .5;
- object_index = SPHERE_0;
- }
- else if (t1 < t0) {
- // Sphere 1.
- M = rayO + rayD * t1;
- object_normal = normalize(M - sphere_position_1);
- object_color = sphere_color_1;
- object_reflection = .5;
- object_index = SPHERE_1;
- }
- else {
- break;
- }
-
- N = object_normal;
- toL = normalize(light_position - M);
- toO = normalize(O - M);
-
- // Shadow of the spheres on the plane.
- if (object_index == PLANE) {
- t0 = intersect_sphere(M + N * .0001, toL,
- sphere_position_0, sphere_radius_0);
- t1 = intersect_sphere(M + N * .0001, toL,
- sphere_position_1, sphere_radius_1);
- if (min(t0, t1) < INFINITY) {
- break;
- }
- }
-
- col_ray = vec3(ambient, ambient, ambient);
- col_ray += light_intensity * max(dot(N, toL), 0.) * object_color;
- col_ray += light_specular.x * light_color *
- pow(max(dot(N, normalize(toL + toO)), 0.), light_specular.y);
-
- /* end trace_ray */
-
- rayO = M + N * .0001;
- rayD = normalize(rayD - 2. * dot(rayD, N) * N);
- col += reflection * col_ray;
- reflection *= object_reflection;
-
- depth++;
- }
-
- return clamp(col, 0., 1.);
-}
-
-void main() {
- vec2 pos = v_position;
- gl_FragColor = vec4(run(pos.x*u_aspect_ratio, pos.y), 1.);
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, position=(300, 100),
- size=(800, 600), keys='interactive')
-
- self.program = gloo.Program(vertex, fragment)
- self.program['a_position'] = [(-1., -1.), (-1., +1.),
- (+1., -1.), (+1., +1.)]
- self.program['sphere_position_0'] = (.75, .1, 1.)
- self.program['sphere_radius_0'] = .6
- self.program['sphere_color_0'] = (0., 0., 1.)
-
- self.program['sphere_position_1'] = (-.75, .1, 2.25)
- self.program['sphere_radius_1'] = .6
- self.program['sphere_color_1'] = (.5, .223, .5)
-
- self.program['plane_position'] = (0., -.5, 0.)
- self.program['plane_normal'] = (0., 1., 0.)
-
- self.program['light_intensity'] = 1.
- self.program['light_specular'] = (1., 50.)
- self.program['light_position'] = (5., 5., -10.)
- self.program['light_color'] = (1., 1., 1.)
- self.program['ambient'] = .05
- self.program['O'] = (0., 0., -1.)
-
- self.activate_zoom()
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def on_timer(self, event):
- t = event.elapsed
- self.program['sphere_position_0'] = (+.75, .1, 2.0 + 1.0 * cos(4*t))
- self.program['sphere_position_1'] = (-.75, .1, 2.0 - 1.0 * cos(4*t))
- self.update()
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- width, height = self.size
- gloo.set_viewport(0, 0, *self.physical_size)
- self.program['u_aspect_ratio'] = width/float(height)
-
- def on_draw(self, event):
- self.program.draw('triangle_strip')
-
-if __name__ == '__main__':
- canvas = Canvas()
- app.run()
diff --git a/examples/demo/gloo/realtime_signals.py b/examples/demo/gloo/realtime_signals.py
deleted file mode 100644
index 8cb2076..0000000
--- a/examples/demo/gloo/realtime_signals.py
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 2
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Multiple real-time digital signals with GLSL-based clipping.
-"""
-
-from vispy import gloo
-from vispy import app
-import numpy as np
-import math
-
-# Number of cols and rows in the table.
-nrows = 16
-ncols = 20
-
-# Number of signals.
-m = nrows*ncols
-
-# Number of samples per signal.
-n = 1000
-
-# Various signal amplitudes.
-amplitudes = .1 + .2 * np.random.rand(m, 1).astype(np.float32)
-
-# Generate the signals as a (m, n) array.
-y = amplitudes * np.random.randn(m, n).astype(np.float32)
-
-# Color of each vertex (TODO: make it more efficient by using a GLSL-based
-# color map and the index).
-color = np.repeat(np.random.uniform(size=(m, 3), low=.5, high=.9),
- n, axis=0).astype(np.float32)
-
-# Signal 2D index of each vertex (row and col) and x-index (sample index
-# within each signal).
-index = np.c_[np.repeat(np.repeat(np.arange(ncols), nrows), n),
- np.repeat(np.tile(np.arange(nrows), ncols), n),
- np.tile(np.arange(n), m)].astype(np.float32)
-
-VERT_SHADER = """
-#version 120
-
-// y coordinate of the position.
-attribute float a_position;
-
-// row, col, and time index.
-attribute vec3 a_index;
-varying vec3 v_index;
-
-// 2D scaling factor (zooming).
-uniform vec2 u_scale;
-
-// Size of the table.
-uniform vec2 u_size;
-
-// Number of samples per signal.
-uniform float u_n;
-
-// Color.
-attribute vec3 a_color;
-varying vec4 v_color;
-
-// Varying variables used for clipping in the fragment shader.
-varying vec2 v_position;
-varying vec4 v_ab;
-
-void main() {
- float nrows = u_size.x;
- float ncols = u_size.y;
-
- // Compute the x coordinate from the time index.
- float x = -1 + 2*a_index.z / (u_n-1);
- vec2 position = vec2(x - (1 - 1 / u_scale.x), a_position);
-
- // Find the affine transformation for the subplots.
- vec2 a = vec2(1./ncols, 1./nrows)*.9;
- vec2 b = vec2(-1 + 2*(a_index.x+.5) / ncols,
- -1 + 2*(a_index.y+.5) / nrows);
- // Apply the static subplot transformation + scaling.
- gl_Position = vec4(a*u_scale*position+b, 0.0, 1.0);
-
- v_color = vec4(a_color, 1.);
- v_index = a_index;
-
- // For clipping test in the fragment shader.
- v_position = gl_Position.xy;
- v_ab = vec4(a, b);
-}
-"""
-
-FRAG_SHADER = """
-#version 120
-
-varying vec4 v_color;
-varying vec3 v_index;
-
-varying vec2 v_position;
-varying vec4 v_ab;
-
-void main() {
- gl_FragColor = v_color;
-
- // Discard the fragments between the signals (emulate glMultiDrawArrays).
- if ((fract(v_index.x) > 0.) || (fract(v_index.y) > 0.))
- discard;
-
- // Clipping test.
- vec2 test = abs((v_position.xy-v_ab.zw)/v_ab.xy);
- if ((test.x > 1) || (test.y > 1))
- discard;
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, title='Use your wheel to zoom!',
- keys='interactive')
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- self.program['a_position'] = y.reshape(-1, 1)
- self.program['a_color'] = color
- self.program['a_index'] = index
- self.program['u_scale'] = (1., 1.)
- self.program['u_size'] = (nrows, ncols)
- self.program['u_n'] = n
-
- gloo.set_viewport(0, 0, *self.physical_size)
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- gloo.set_state(clear_color='black', blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- self.show()
-
- def on_resize(self, event):
- gloo.set_viewport(0, 0, *event.physical_size)
-
- def on_mouse_wheel(self, event):
- dx = np.sign(event.delta[1]) * .05
- scale_x, scale_y = self.program['u_scale']
- scale_x_new, scale_y_new = (scale_x * math.exp(2.5*dx),
- scale_y * math.exp(0.0*dx))
- self.program['u_scale'] = (max(1, scale_x_new), max(1, scale_y_new))
- self.update()
-
- def on_timer(self, event):
- """Add some data at the end of each signal (real-time signals)."""
- k = 10
- y[:, :-k] = y[:, k:]
- y[:, -k:] = amplitudes * np.random.randn(m, k)
-
- self.program['a_position'].set_data(y.ravel().astype(np.float32))
- self.update()
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('line_strip')
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/shadertoy.py b/examples/demo/gloo/shadertoy.py
deleted file mode 100644
index 1efdc85..0000000
--- a/examples/demo/gloo/shadertoy.py
+++ /dev/null
@@ -1,441 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 2, testskip
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Shadertoy demo. You can copy-paste shader code from an example on
-www.shadertoy.com and get the demo.
-
-TODO: support cubes and videos as channel inputs (currently, only images
-are supported).
-
-"""
-
-# NOTE: This example throws warnings about variables not being used;
-# this is normal because only some shadertoy examples make use of all
-# variables, and the GPU may compile some of them away.
-
-import sys
-from datetime import datetime, time
-import numpy as np
-from vispy import gloo
-from vispy import app
-
-
-vertex = """
-#version 120
-
-attribute vec2 position;
-void main()
-{
- gl_Position = vec4(position, 0.0, 1.0);
-}
-"""
-
-fragment = """
-#version 120
-
-uniform vec3 iResolution; // viewport resolution (in pixels)
-uniform float iGlobalTime; // shader playback time (in seconds)
-uniform vec4 iMouse; // mouse pixel coords
-uniform vec4 iDate; // (year, month, day, time in seconds)
-uniform float iSampleRate; // sound sample rate (i.e., 44100)
-uniform sampler2D iChannel0; // input channel. XX = 2D/Cube
-uniform sampler2D iChannel1; // input channel. XX = 2D/Cube
-uniform sampler2D iChannel2; // input channel. XX = 2D/Cube
-uniform sampler2D iChannel3; // input channel. XX = 2D/Cube
-uniform vec3 iChannelResolution[4]; // channel resolution (in pixels)
-uniform float iChannelTime[4]; // channel playback time (in sec)
-
-%s
-"""
-
-
-def get_idate():
- now = datetime.now()
- utcnow = datetime.utcnow()
- midnight_utc = datetime.combine(utcnow.date(), time(0))
- delta = utcnow - midnight_utc
- return (now.year, now.month, now.day, delta.seconds)
-
-
-def noise(resolution=64, nchannels=1):
- # Random texture.
- return np.random.randint(low=0, high=256,
- size=(resolution, resolution, nchannels)
- ).astype(np.uint8)
-
-
-class Canvas(app.Canvas):
-
- def __init__(self, shadertoy=None):
- app.Canvas.__init__(self, keys='interactive')
- if shadertoy is None:
- shadertoy = """
- void main(void)
- {
- vec2 uv = gl_FragCoord.xy / iResolution.xy;
- gl_FragColor = vec4(uv,0.5+0.5*sin(iGlobalTime),1.0);
- }"""
- self.program = gloo.Program(vertex, fragment % shadertoy)
-
- self.program["position"] = [(-1, -1), (-1, 1), (1, 1),
- (-1, -1), (1, 1), (1, -1)]
- self.program['iMouse'] = 0, 0, 0, 0
-
- self.program['iSampleRate'] = 44100.
- for i in range(4):
- self.program['iChannelTime[%d]' % i] = 0.
-
- self.activate_zoom()
-
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
-
- self.show()
-
- def set_channel_input(self, img, i=0):
- tex = gloo.Texture2D(img)
- tex.interpolation = 'linear'
- tex.wrapping = 'repeat'
- self.program['iChannel%d' % i] = tex
- self.program['iChannelResolution[%d]' % i] = img.shape
-
- def on_draw(self, event):
- self.program.draw()
-
- def on_mouse_click(self, event):
- # BUG: DOES NOT WORK YET, NO CLICK EVENT IN VISPY FOR NOW...
- imouse = event.pos + event.pos
- self.program['iMouse'] = imouse
-
- def on_mouse_move(self, event):
- if event.is_dragging:
- x, y = event.pos
- px, py = event.press_event.pos
- imouse = (x, self.size[1] - y, px, self.size[1] - py)
- self.program['iMouse'] = imouse
-
- def on_timer(self, event):
- self.program['iGlobalTime'] = event.elapsed
- self.program['iDate'] = get_idate() # used in some shadertoy exs
- self.update()
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- gloo.set_viewport(0, 0, *self.physical_size)
- self.program['iResolution'] = (self.physical_size[0],
- self.physical_size[1], 0.)
-
-# -------------------------------------------------------------------------
-# COPY-PASTE SHADERTOY CODE BELOW
-# -------------------------------------------------------------------------
-SHADERTOY = """
-// From: https://www.shadertoy.com/view/MdX3Rr
-
-// Created by inigo quilez - iq/2013
-// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0
-// Unported License.
-
-//stereo thanks to Croqueteer
-//#define STEREO
-
-// value noise, and its analytical derivatives
-vec3 noised( in vec2 x )
-{
- vec2 p = floor(x);
- vec2 f = fract(x);
-
- vec2 u = f*f*(3.0-2.0*f);
-
- float a = texture2D(iChannel0,(p+vec2(0.5,0.5))/256.0,-100.0).x;
- float b = texture2D(iChannel0,(p+vec2(1.5,0.5))/256.0,-100.0).x;
- float c = texture2D(iChannel0,(p+vec2(0.5,1.5))/256.0,-100.0).x;
- float d = texture2D(iChannel0,(p+vec2(1.5,1.5))/256.0,-100.0).x;
-
- return vec3(a+(b-a)*u.x+(c-a)*u.y+(a-b-c+d)*u.x*u.y,
- 6.0*f*(1.0-f)*(vec2(b-a,c-a)+(a-b-c+d)*u.yx));
-}
-
-const mat2 m2 = mat2(0.8,-0.6,0.6,0.8);
-
-float terrain( in vec2 x )
-{
- vec2 p = x*0.003;
- float a = 0.0;
- float b = 1.0;
- vec2 d = vec2(0.0);
- for( int i=0; i<6; i++ )
- {
- vec3 n = noised(p);
- d += n.yz;
- a += b*n.x/(1.0+dot(d,d));
- b *= 0.5;
- p = m2*p*2.0;
- }
-
- return 140.0*a;
-}
-
-float terrain2( in vec2 x )
-{
- vec2 p = x*0.003;
- float a = 0.0;
- float b = 1.0;
- vec2 d = vec2(0.0);
- for( int i=0; i<14; i++ )
- {
- vec3 n = noised(p);
- d += n.yz;
- a += b*n.x/(1.0+dot(d,d));
- b *= 0.5;
- p=m2*p*2.0;
- }
-
- return 140.0*a;
-}
-
-float terrain3( in vec2 x )
-{
- vec2 p = x*0.003;
- float a = 0.0;
- float b = 1.0;
- vec2 d = vec2(0.0);
- for( int i=0; i<4; i++ )
- {
- vec3 n = noised(p);
- d += n.yz;
- a += b*n.x/(1.0+dot(d,d));
- b *= 0.5;
- p = m2*p*2.0;
- }
-
- return 140.0*a;
-}
-
-float map( in vec3 p )
-{
- float h = terrain(p.xz);
- return p.y - h;
-}
-
-float map2( in vec3 p )
-{
- float h = terrain2(p.xz);
- return p.y - h;
-}
-
-float interesct( in vec3 ro, in vec3 rd )
-{
- float h = 1.0;
- float t = 1.0;
- for( int i=0; i<120; i++ )
- {
- if( h<0.01 || t>2000.0 ) break;
- t += 0.5*h;
- h = map( ro + t*rd );
- }
-
- if( t>2000.0 ) t = -1.0;
- return t;
-}
-
-float sinteresct(in vec3 ro, in vec3 rd )
-{
-#if 0
- // no shadows
- return 1.0;
-#endif
-
-#if 0
- // fake shadows
- vec3 nor;
- vec3 eps = vec3(20.0,0.0,0.0);
- nor.x = terrain3(ro.xz-eps.xy) - terrain3(ro.xz+eps.xy);
- nor.y = 1.0*eps.x;
- nor.z = terrain3(ro.xz-eps.yx) - terrain3(ro.xz+eps.yx);
- nor = normalize(nor);
- return clamp( 4.0*dot(nor,rd), 0.0, 1.0 );
-#endif
-
-#if 1
- // real shadows
- float res = 1.0;
- float t = 0.0;
- for( int j=0; j<48; j++ )
- {
- vec3 p = ro + t*rd;
- float h = map( p );
- res = min( res, 16.0*h/t );
- t += h;
- if( res<0.001 ||p.y>300.0 ) break;
- }
-
- return clamp( res, 0.0, 1.0 );
-#endif
-}
-
-vec3 calcNormal( in vec3 pos, float t )
-{
- float e = 0.001;
- e = 0.001*t;
- vec3 eps = vec3(e,0.0,0.0);
- vec3 nor;
-#if 0
- nor.x = map2(pos+eps.xyy) - map2(pos-eps.xyy);
- nor.y = map2(pos+eps.yxy) - map2(pos-eps.yxy);
- nor.z = map2(pos+eps.yyx) - map2(pos-eps.yyx);
-#else
- nor.x = terrain2(pos.xz-eps.xy) - terrain2(pos.xz+eps.xy);
- nor.y = 2.0*e;
- nor.z = terrain2(pos.xz-eps.yx) - terrain2(pos.xz+eps.yx);
-#endif
- return normalize(nor);
-}
-
-vec3 camPath( float time )
-{
- vec2 p = 1100.0*vec2( cos(0.0+0.23*time), cos(1.5+0.21*time) );
-
- return vec3( p.x, 0.0, p.y );
-}
-
-
-float fbm( vec2 p )
-{
- float f = 0.0;
-
- f += 0.5000*texture2D( iChannel0, p/256.0 ).x; p = m2*p*2.02;
- f += 0.2500*texture2D( iChannel0, p/256.0 ).x; p = m2*p*2.03;
- f += 0.1250*texture2D( iChannel0, p/256.0 ).x; p = m2*p*2.01;
- f += 0.0625*texture2D( iChannel0, p/256.0 ).x;
-
- return f/0.9375;
-}
-
-
-void main(void)
-{
- vec2 xy = -1.0 + 2.0*gl_FragCoord.xy / iResolution.xy;
-
- vec2 s = xy*vec2(iResolution.x/iResolution.y,1.0);
-
- #ifdef STEREO
- float isCyan = mod(gl_FragCoord.x + mod(gl_FragCoord.y,2.0),2.0);
- #endif
-
- float time = iGlobalTime*0.15 + 0.3 + 4.0*iMouse.x/iResolution.x;
-
- vec3 light1 = normalize( vec3(-0.8,0.4,-0.3) );
-
-
-
- vec3 ro = camPath( time );
- vec3 ta = camPath( time + 3.0 );
- ro.y = terrain3( ro.xz ) + 11.0;
- ta.y = ro.y - 20.0;
-
- float cr = 0.2*cos(0.1*time);
- vec3 cw = normalize(ta-ro);
- vec3 cp = vec3(sin(cr), cos(cr),0.0);
- vec3 cu = normalize( cross(cw,cp) );
- vec3 cv = normalize( cross(cu,cw) );
- vec3 rd = normalize( s.x*cu + s.y*cv + 2.0*cw );
-
- #ifdef STEREO
- ro += 2.0*cu*isCyan;
- #endif
-
- float sundot = clamp(dot(rd,light1),0.0,1.0);
- vec3 col;
- float t = interesct( ro, rd );
- if( t<0.0 )
- {
- // sky
- col = vec3(0.3,.55,0.8)*(1.0-0.8*rd.y);
- col += 0.25*vec3(1.0,0.7,0.4)*pow( sundot,5.0 );
- col += 0.25*vec3(1.0,0.8,0.6)*pow( sundot,64.0 );
- col += 0.2*vec3(1.0,0.8,0.6)*pow( sundot,512.0 );
- vec2 sc = ro.xz + rd.xz*(1000.0-ro.y)/rd.y;
- col = mix( col, vec3(1.0,0.95,1.0),
- 0.5*smoothstep(0.5,0.8,fbm(0.0005*sc)) );
- }
- else
- {
- // mountains
- vec3 pos = ro + t*rd;
-
- vec3 nor = calcNormal( pos, t );
-
- float r = texture2D( iChannel0, 7.0*pos.xz/256.0 ).x;
-
- col = (r*0.25+0.75)*0.9*mix( vec3(0.08,0.05,0.03),
- vec3(0.10,0.09,0.08), texture2D(iChannel0,0.00007*vec2(
- pos.x,pos.y*48.0)).x );
- col = mix( col, 0.20*vec3(0.45,.30,0.15)*(0.50+0.50*r),
- smoothstep(0.70,0.9,nor.y) );
- col = mix( col, 0.15*vec3(0.30,.30,0.10)*(0.25+0.75*r),
- smoothstep(0.95,1.0,nor.y) );
-
- // snow
- float h = smoothstep(55.0,80.0,pos.y + 25.0*fbm(0.01*pos.xz) );
- float e = smoothstep(1.0-0.5*h,1.0-0.1*h,nor.y);
- float o = 0.3 + 0.7*smoothstep(0.0,0.1,nor.x+h*h);
- float s = h*e*o;
- col = mix( col, 0.29*vec3(0.62,0.65,0.7), smoothstep(
- 0.1, 0.9, s ) );
-
- // lighting
- float amb = clamp(0.5+0.5*nor.y,0.0,1.0);
- float dif = clamp( dot( light1, nor ), 0.0, 1.0 );
- float bac = clamp( 0.2 + 0.8*dot( normalize(
- vec3(-light1.x, 0.0, light1.z ) ), nor ), 0.0, 1.0 );
- float sh = 1.0; if( dif>=0.0001 ) sh = sinteresct(
- pos+light1*20.0,light1);
-
- vec3 lin = vec3(0.0);
- lin += dif*vec3(7.00,5.00,3.00)*vec3( sh, sh*sh*0.5+0.5*sh,
- sh*sh*0.8+0.2*sh );
- lin += amb*vec3(0.40,0.60,0.80)*1.5;
- lin += bac*vec3(0.40,0.50,0.60);
- col *= lin;
-
-
- float fo = 1.0-exp(-0.0005*t);
- vec3 fco = 0.55*vec3(0.55,0.65,0.75) + 0.1*vec3(1.0,0.8,0.5)*pow(
- sundot, 4.0 );
- col = mix( col, fco, fo );
-
- col += 0.3*vec3(1.0,0.8,0.4)*pow( sundot,
- 8.0 )*(1.0-exp(-0.002*t));
- }
-
- col = pow(col,vec3(0.4545));
-
- // vignetting
- col *= 0.5 + 0.5*pow( (xy.x+1.0)*(xy.y+1.0)*(xy.x-1.0)*(xy.y-1.0),
- 0.1 );
-
- #ifdef STEREO
- col *= vec3( isCyan, 1.0-isCyan, 1.0-isCyan );
- #endif
-
-// col *= smoothstep( 0.0, 2.0, iGlobalTime );
-
- gl_FragColor=vec4(col,1.0);
-}
-"""
-# -------------------------------------------------------------------------
-
-canvas = Canvas(SHADERTOY)
-# Input data.
-canvas.set_channel_input(noise(resolution=256, nchannels=1), i=0)
-
-if __name__ == '__main__':
-
- canvas.show()
- if sys.flags.interactive == 0:
- canvas.app.run()
diff --git a/examples/demo/gloo/signals.py b/examples/demo/gloo/signals.py
deleted file mode 100644
index efee0b4..0000000
--- a/examples/demo/gloo/signals.py
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vispy: gallery 2
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Multiple digital signals.
-"""
-
-from vispy import gloo
-from vispy import app
-import numpy as np
-import math
-
-m = 20
-n = 25000
-x = np.tile(np.linspace(-1., 1., n), m)
-y = .1 * np.random.randn(m, n)
-y += np.arange(m).reshape((-1, 1))
-
-data = np.zeros(n*m, dtype=[
- ('a_position', np.float32, 2),
- ('a_color', np.float32, 3),
- ('a_index', np.float32, 1),
-])
-
-data['a_position'] = np.zeros((n*m, 2), dtype=np.float32)
-data['a_position'][:, 0] = x
-data['a_position'][:, 1] = .9*(y.ravel()/y.max()*2-1)
-
-data['a_color'] = np.repeat(np.random.uniform(size=(m, 3), low=.5, high=.9),
- n, axis=0)
-
-data['a_index'] = np.repeat(np.arange(m), n)
-
-VERT_SHADER = """
-#version 120
-attribute vec2 a_position;
-attribute float a_index;
-varying float v_index;
-
-attribute vec3 a_color;
-varying vec3 v_color;
-
-uniform vec2 u_pan;
-uniform vec2 u_scale;
-
-void main() {
-
- vec2 position_tr = u_scale * (a_position + u_pan);
- gl_Position = vec4(position_tr, 0.0, 1.0);
- v_color = a_color;
- v_index = a_index;
-}
-"""
-
-FRAG_SHADER = """
-#version 120
-varying vec3 v_color;
-varying float v_index;
-void main() {
- gl_FragColor = vec4(v_color, 1.0);
- if ((fract(v_index) > .00001) && (fract(v_index) < .99999))
- gl_FragColor.a = 0.;
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- self.program.bind(gloo.VertexBuffer(data))
-
- self.program['u_pan'] = (0., 0.)
- self.program['u_scale'] = (1., 1.)
-
- gloo.set_viewport(0, 0, *self.physical_size)
-
- gloo.set_state(clear_color=(1, 1, 1, 1), blend=True,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- self.show()
-
- def on_resize(self, event):
- gloo.set_viewport(0, 0, *event.physical_size)
-
- def on_draw(self, event):
- gloo.clear(color=(0.0, 0.0, 0.0, 1.0))
- self.program.draw('line_strip')
-
- def _normalize(self, x_y):
- x, y = x_y
- w, h = float(self.size[0]), float(self.size[1])
- return x/(w/2.)-1., y/(h/2.)-1.
-
- def on_mouse_move(self, event):
- if event.is_dragging:
- x0, y0 = self._normalize(event.press_event.pos)
- x1, y1 = self._normalize(event.last_event.pos)
- x, y = self._normalize(event.pos)
- dx, dy = x - x1, -(y - y1)
- button = event.press_event.button
-
- pan_x, pan_y = self.program['u_pan']
- scale_x, scale_y = self.program['u_scale']
-
- if button == 1:
- self.program['u_pan'] = (pan_x+dx/scale_x, pan_y+dy/scale_y)
- elif button == 2:
- scale_x_new, scale_y_new = (scale_x * math.exp(2.5*dx),
- scale_y * math.exp(2.5*dy))
- self.program['u_scale'] = (scale_x_new, scale_y_new)
- self.program['u_pan'] = (pan_x -
- x0 * (1./scale_x - 1./scale_x_new),
- pan_y +
- y0 * (1./scale_y - 1./scale_y_new))
- self.update()
-
- def on_mouse_wheel(self, event):
- dx = np.sign(event.delta[1])*.05
- scale_x, scale_y = self.program['u_scale']
- scale_x_new, scale_y_new = (scale_x * math.exp(2.5*dx),
- scale_y * math.exp(2.5*dx))
- self.program['u_scale'] = (scale_x_new, scale_y_new)
- self.update()
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/spacy.py b/examples/demo/gloo/spacy.py
deleted file mode 100644
index 3f6025a..0000000
--- a/examples/demo/gloo/spacy.py
+++ /dev/null
@@ -1,174 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# -----------------------------------------------------------------------------
-# 2014, Almar Klein
-# Distributed under the terms of the new BSD License.
-# -----------------------------------------------------------------------------
-
-""" Visualization of traveling through space.
-"""
-
-import time
-
-import numpy as np
-
-from vispy import gloo
-from vispy import app
-from vispy.util.transforms import perspective
-
-
-vertex = """
-#version 120
-
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform float u_time_offset;
-uniform float u_pixel_scale;
-
-attribute vec3 a_position;
-attribute float a_offset;
-
-varying float v_pointsize;
-
-void main (void) {
-
- vec3 pos = a_position;
- pos.z = pos.z - a_offset - u_time_offset;
- vec4 v_eye_position = u_view * u_model * vec4(pos, 1.0);
- gl_Position = u_projection * v_eye_position;
-
- // stackoverflow.com/questions/8608844/...
- // ... resizing-point-sprites-based-on-distance-from-the-camera
- float radius = 1;
- vec4 corner = vec4(radius, radius, v_eye_position.z, v_eye_position.w);
- vec4 proj_corner = u_projection * corner;
- gl_PointSize = 100.0 * u_pixel_scale * proj_corner.x / proj_corner.w;
- v_pointsize = gl_PointSize;
-}
-"""
-
-fragment = """
-#version 120
-varying float v_pointsize;
-void main()
-{
- float x = 2.0*gl_PointCoord.x - 1.0;
- float y = 2.0*gl_PointCoord.y - 1.0;
- float a = 0.9 - (x*x + y*y);
- a = a * min(1.0, v_pointsize/1.5);
- gl_FragColor = vec4(1.0, 1.0, 1.0, a);
-}
-"""
-
-N = 100000 # Number of stars
-SIZE = 100
-SPEED = 4.0 # time in seconds to go through one block
-NBLOCKS = 10
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, title='Spacy', keys='interactive',
- size=(800, 600))
-
- self.program = gloo.Program(vertex, fragment)
- self.view = np.eye(4, dtype=np.float32)
- self.model = np.eye(4, dtype=np.float32)
-
- self.activate_zoom()
-
- self.timer = app.Timer('auto', connect=self.update, start=True)
-
- # Set uniforms (some are set later)
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
- self.program['u_pixel_scale'] = self.pixel_scale
-
- # Set attributes
- self.program['a_position'] = np.zeros((N, 3), np.float32)
- self.program['a_offset'] = np.zeros((N, 1), np.float32)
-
- # Init
- self._timeout = 0
- self._active_block = 0
- for i in range(NBLOCKS):
- self._generate_stars()
- self._timeout = time.time() + SPEED
-
- gloo.set_state(clear_color='black', depth_test=False,
- blend=True, blend_equation='func_add',
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- self.show()
-
- def on_key_press(self, event):
- if event.text == ' ':
- if self.timer.running:
- self.timer.stop()
- else:
- self.timer.start()
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- width, height = self.size
- gloo.set_viewport(0, 0, *self.physical_size)
- far = SIZE*(NBLOCKS-2)
- self.projection = perspective(25.0, width / float(height), 1.0, far)
- self.program['u_projection'] = self.projection
-
- def on_draw(self, event):
- # Set time offset. Factor runs from 1 to 0
- # the time offset goes from 0 to size
- factor = (self._timeout - time.time()) / SPEED
- self.program['u_time_offset'] = -(1-factor) * SIZE
-
- # Draw
- gloo.clear()
- self.program.draw('points')
-
- # Build new starts if the first block is fully behind us
- if factor < 0:
- self._generate_stars()
-
- def on_close(self, event):
- self.timer.stop()
-
- def _generate_stars(self):
-
- # Get number of stars in each block
- blocksize = N // NBLOCKS
-
- # Update active block
- self._active_block += 1
- if self._active_block >= NBLOCKS:
- self._active_block = 0
-
- # Create new position data for the active block
- pos = np.zeros((blocksize, 3), 'float32')
- pos[:, :2] = np.random.normal(0.0, SIZE/2, (blocksize, 2)) # x-y
- pos[:, 2] = np.random.uniform(0, SIZE, (blocksize,)) # z
- start_index = self._active_block * blocksize
- self.program['a_position'].set_subdata(pos, offset=start_index)
-
- #print(start_index)
-
- # Set offsets - active block gets offset 0
- for i in range(NBLOCKS):
- val = i - self._active_block
- if val < 0:
- val += NBLOCKS
- values = np.ones((blocksize, 1), 'float32') * val * SIZE
- start_index = i*blocksize
- self.program['a_offset'].set_subdata(values, offset=start_index)
-
- # Reset timer
- self._timeout += SPEED
-
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/terrain.py b/examples/demo/gloo/terrain.py
deleted file mode 100644
index df5fcfd..0000000
--- a/examples/demo/gloo/terrain.py
+++ /dev/null
@@ -1,212 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30, testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-
-""" Terrain generation using diamond-square alogrithm
-and Scipy for Delaunay triangulation
-"""
-
-from vispy import gloo
-from vispy import app
-from vispy.util.transforms import perspective, translate, rotate
-import numpy as np
-from scipy.spatial import Delaunay
-
-# Arrays for storing generated points and triangles
-points = []
-triangles = []
-height = 0.0
-
-
-def generate_terrain(r_min, r_max, c_min, c_max, disp):
- """Recursively generates terrain using diamond-square algorithm
- and stores the vertices in points
- """
- a = points[r_min][c_min][2]
- b = points[r_min][c_max][2]
- c = points[r_max][c_min][2]
- d = points[r_max][c_max][2]
-
- r_mid = (r_min + r_max)/2
- c_mid = (c_min + c_max)/2
-
- e = (a+b+c+d)/4 + np.random.uniform(0, disp)
-
- points[r_mid][c_mid][2] = e
-
- points[r_min][c_mid][2] = (a + b + e)/3 + np.random.uniform(0, disp)
- points[r_max][c_mid][2] = (c + d + e)/3 + np.random.uniform(0, disp)
- points[r_mid][c_min][2] = (a + c + e)/3 + np.random.uniform(0, disp)
- points[r_mid][c_max][2] = (b + d + e)/3 + np.random.uniform(0, disp)
-
- new_disp = disp * (2 ** (-0.5))
-
- if (r_mid - r_min > 1 or c_mid - c_min > 1):
- generate_terrain(r_min, r_mid, c_min, c_mid, new_disp)
- if (r_max - r_mid > 1 or c_mid - c_min > 1):
- generate_terrain(r_mid, r_max, c_min, c_mid, new_disp)
- if (r_mid - r_min > 1 or c_max - c_mid > 1):
- generate_terrain(r_min, r_mid, c_mid, c_max, new_disp)
- if (r_max - r_mid > 1 or c_max - c_mid > 1):
- generate_terrain(r_mid, r_max, c_mid, c_max, new_disp)
-
-
-def generate_points(length=3):
- """Generates points via recursive function and generate triangles using
- Scipy Delaunay triangulation
-
- Parameters
- ----------
- length : int
- (2 ** length + 1 by 2 ** length + 1) number of points is generated
-
- """
- print("Points are being generated...")
- global points, triangles, height
- size = 2**(length) + 1
- points = np.indices((size, size, 1)).T[0].transpose((1, 0, 2))
- points = points.astype(np.float32)
- generate_terrain(0, size-1, 0, size-1, length)
- height = length
- points = np.resize(points, (size*size, 3))
- points2 = np.delete(points, 2, 1)
- tri = Delaunay(points2)
- triangles = points[tri.simplices]
- triangles = np.vstack(triangles)
- print("Points successfully generated.")
-
-VERT_SHADER = """
-uniform float u_height;
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-
-attribute vec3 a_position;
-
-varying vec4 v_color;
-
-void main (void) {
- gl_Position = u_projection * u_view * u_model * vec4(a_position, 1.0);
- v_color = vec4(0.0, a_position[2] * a_position[2] / (u_height * u_height
- * u_height), 0.1, 1.0);
-}
-"""
-
-FRAG_SHADER = """
-varying vec4 v_color;
-
-void main()
-{
- gl_FragColor = v_color;
-}
-"""
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, keys='interactive')
- self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)
- # Sets the view to an appropriate position over the terrain
- self.default_view = np.array([[0.8, 0.2, -0.48, 0],
- [-0.5, 0.3, -0.78, 0],
- [-0.01, 0.9, -0.3, 0],
- [-4.5, -21.5, -7.4, 1]],
- dtype=np.float32)
- self.view = self.default_view
- self.model = np.eye(4, dtype=np.float32)
- self.projection = np.eye(4, dtype=np.float32)
-
- self.translate = [0, 0, 0]
- self.rotate = [0, 0, 0]
-
- self.program['u_height'] = height
- self.program['u_model'] = self.model
- self.program['u_view'] = self.view
-
- self.program['a_position'] = gloo.VertexBuffer(triangles)
-
- self.activate_zoom()
-
- gloo.set_state(clear_color='black', depth_test=True)
-
- self.show()
-
- def on_key_press(self, event):
- """Controls -
- a(A) - move left
- d(D) - move right
- w(W) - move up
- s(S) - move down
- x/X - rotate about x-axis cw/anti-cw
- y/Y - rotate about y-axis cw/anti-cw
- z/Z - rotate about z-axis cw/anti-cw
- space - reset view
- p(P) - print current view
- i(I) - zoom in
- o(O) - zoom out
- """
- self.translate = [0, 0, 0]
- self.rotate = [0, 0, 0]
-
- if(event.text == 'p' or event.text == 'P'):
- print(self.view)
- elif(event.text == 'd' or event.text == 'D'):
- self.translate[0] = 0.3
- elif(event.text == 'a' or event.text == 'A'):
- self.translate[0] = -0.3
- elif(event.text == 'w' or event.text == 'W'):
- self.translate[1] = 0.3
- elif(event.text == 's' or event.text == 'S'):
- self.translate[1] = -0.3
- elif(event.text == 'o' or event.text == 'O'):
- self.translate[2] = 0.3
- elif(event.text == 'i' or event.text == 'I'):
- self.translate[2] = -0.3
- elif(event.text == 'x'):
- self.rotate = [1, 0, 0]
- elif(event.text == 'X'):
- self.rotate = [-1, 0, 0]
- elif(event.text == 'y'):
- self.rotate = [0, 1, 0]
- elif(event.text == 'Y'):
- self.rotate = [0, -1, 0]
- elif(event.text == 'z'):
- self.rotate = [0, 0, 1]
- elif(event.text == 'Z'):
- self.rotate = [0, 0, -1]
- elif(event.text == ' '):
- self.view = self.default_view
-
- self.view = self.view.dot(
- translate(-np.array(self.translate)).dot(
- rotate(self.rotate[0], (1, 0, 0)).dot(
- rotate(self.rotate[1], (0, 1, 0)).dot(
- rotate(self.rotate[2], (0, 0, 1))))))
- self.program['u_view'] = self.view
- self.update()
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- gloo.set_viewport(0, 0, *self.physical_size)
- self.projection = perspective(60.0, self.size[0] /
- float(self.size[1]), 1.0, 100.0)
- self.program['u_projection'] = self.projection
-
- def on_draw(self, event):
- # Clear
- gloo.clear(color=True, depth=True)
- # Draw
- self.program.draw('triangles')
-
-
-generate_points(8)
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/demo/gloo/unstructured_2d.py b/examples/demo/gloo/unstructured_2d.py
deleted file mode 100644
index 667da02..0000000
--- a/examples/demo/gloo/unstructured_2d.py
+++ /dev/null
@@ -1,216 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Per Rosengren
-# Date: 18/03/2014
-# Abstract: Unstructured2D canvas example
-# Keywords: unstructured delaunay colormap
-# Require: scipy
-# ----------------------------------------------------------------------------
-"""Unstructured2D canvas example.
-
-Takes unstructured 2D locations, with corresponding 1 or 2 dimensional
-scalar "values". Plots the values looked up from colormaps and
-interpolated between the locations.
-"""
-import sys
-import numpy as np
-import scipy.spatial
-
-from vispy import gloo, app
-from vispy.util.transforms import ortho
-
-
-class Canvas(app.Canvas):
-
- def __init__(self,
- x=None, y=None, u=None, v=None,
- colormap=None, data_lim=None,
- dir_x_right=True, dir_y_top=True,
- **kwargs):
- app.Canvas.__init__(self, **kwargs)
- self.create_shader(colormap)
- self.create_mesh(x, y, u, v)
- self.program.bind(self.vbo)
- if data_lim is not None:
- self._data_lim = data_lim
- else:
- self._data_lim = [[x.min(), x.max()], [y.min(), y.max()]]
- self._dir_x_right = dir_x_right
- self._dir_y_top = dir_y_top
-
- self.activate_zoom()
-
- self.show()
-
- def create_shader(self, colormap):
- if len(colormap.shape) == 2:
- args = dict(
- n_dims="1",
- tex_t="float",
- texture2D_arg="vec2(v_texcoord, 0.)")
- else:
- args = dict(
- n_dims="2",
- tex_t="vec2",
- texture2D_arg="v_texcoord")
- vertex = """
- uniform mat4 projection;
- uniform sampler2D texture;
-
- attribute vec2 position;
- attribute {tex_t} texcoord;
-
- varying {tex_t} v_texcoord;
- void main()
- {{
- gl_Position = projection * vec4(position, 0.0, 1.0);
- v_texcoord = texcoord;
- }}
- """.format(**args)
-
- fragment = """
- uniform sampler2D texture;
- varying {tex_t} v_texcoord;
- void main()
- {{
- gl_FragColor = texture2D(texture, {texture2D_arg});
- }}
- """.format(**args)
-
- self.program = gloo.Program(vertex, fragment)
- if len(colormap.shape) == 2:
- self.program['texture'] = np.ascontiguousarray(
- colormap[None, :, :])
- else:
- self.program['texture'] = colormap
- self.program['texture'].interpolation = 'linear'
- self.projection = np.eye(4, dtype=np.float32)
-
- def create_mesh(self, x, y, u, v):
- tri = scipy.spatial.Delaunay(np.column_stack([x, y]))
- edges = tri.simplices.astype(np.uint32)
- uv = []
- for c in [u, v]:
- if c is not None:
- c = c.astype('f4')
- c = .5 + .5 * c / np.abs(c).max()
- uv.append(c)
- data = np.column_stack(
- [
- x.astype('f4'),
- y.astype('f4')
- ] + uv
- ).view(dtype=[('position', 'f4', 2),
- ('texcoord', 'f4', 2 if v is not None else 1),
- ])
- self.vbo = gloo.VertexBuffer(data)
- self.index = gloo.IndexBuffer(edges)
-
- gloo.set_state(blend=True, clear_color='white',
- blend_func=('src_alpha', 'one_minus_src_alpha'))
-
- def on_draw(self, event):
- gloo.clear()
- self.program.draw('triangles', self.index)
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- width, heigh = self.size
- gloo.set_viewport(0, 0, *self.physical_size)
- data_width = self._data_lim[0][1] - self._data_lim[0][0]
- data_height = self._data_lim[1][1] - self._data_lim[1][0]
- data_aspect = data_width / float(data_height)
- frame_aspect = width / float(height)
- if frame_aspect >= data_aspect:
- padding = (frame_aspect * data_height - data_width) / 2.
- frame_lim = [
- [self._data_lim[0][0] - padding,
- self._data_lim[0][1] + padding],
- [self._data_lim[1][0],
- self._data_lim[1][1]]]
- else:
- padding = (data_width / frame_aspect - data_height) / 2.
- frame_lim = [
- [self._data_lim[0][0],
- self._data_lim[0][1]],
- [self._data_lim[1][0] - padding,
- self._data_lim[1][1] + padding]]
- args_ortho = frame_lim[0][::(1 if self._dir_x_right else -1)]
- args_ortho += frame_lim[1][::(1 if self._dir_y_top else -1)]
- args_ortho += -1000, 1000
- self.projection = ortho(*args_ortho)
- self.program['projection'] = self.projection
-
-
-def create_colormap2d_hsv(size=512):
- import matplotlib.colors
- import math
- u, v = np.meshgrid(np.linspace(-1, 1, size), np.linspace(-1, 1, size))
- hsv = np.ones((size, size, 3), dtype=np.float32)
- hsv[:, :, 0] = (np.arctan2(u, v) / (2 * math.pi) + .5)
- hsv[:, :, 1] = np.minimum(1., np.sqrt(u ** 2 + v ** 2))
- rgb = matplotlib.colors.hsv_to_rgb(hsv)
- return rgb
-
-
-def create_colormap2d_4dirs(size=512):
- rgb = np.ones((size, size, 3), dtype=np.float32)
- hs = size / 2
- u, v = np.meshgrid(np.linspace(1, 0, hs), np.linspace(1, 0, hs))
- rgb[:hs, :hs, 0] = 1.
- rgb[:hs, :hs, 1] = 1. - v + u / 2.
- rgb[:hs, :hs, 2] = 1. - np.maximum(u, v)
- u = u[:, ::-1]
- rgb[:hs, hs:, 0] = 1. - u + v
- rgb[:hs, hs:, 1] = 1. - np.maximum(u, v)
- rgb[:hs, hs:, 2] = 1. - v + u
- v = v[::-1, :]
- rgb[hs:, hs:, 0] = 1. - np.maximum(u, v)
- rgb[hs:, hs:, 1] = 1. - u + v
- rgb[hs:, hs:, 2] = 1. - v + u
- u = u[:, ::-1]
- rgb[hs:, :hs, 0] = 1. - v + u / 2.
- rgb[hs:, :hs, 1] = 1.
- rgb[hs:, :hs, 2] = 1. - np.maximum(u, v)
- rgb = np.minimum(1., rgb)
- return rgb
-
-
-def create_colormap1d_hot(size=512):
- rgb = np.ones((size, 3), dtype=np.float32)
- hs = size / 2
- u = np.linspace(1, 0, hs)
- rgb[:hs, 0] = 1 - u
- rgb[:hs, 1] = 1 - u
- u = u[::-1]
- rgb[hs:, 1] = 1 - u
- rgb[hs:, 2] = 1 - u
- return rgb
-
-
-if __name__ == '__main__':
- loc = np.random.random_sample(size=(100, 2))
- np.random.shuffle(loc)
- vec = np.empty_like(loc)
- vec[:, 0] = np.cos(loc[:, 0] * 10)
- vec[:, 1] = np.cos(loc[:, 1] * 13)
- width = 500
- height = 500
- c1 = Canvas(title="Unstructured 2D - 2D colormap",
- size=(width, height), position=(0, 40),
- x=loc[:, 0], y=loc[:, 1], u=vec[:, 0], v=vec[:, 1],
- colormap=create_colormap2d_4dirs(size=128),
- keys='interactive')
- c2 = Canvas(title="Unstructured 2D - 1D colormap",
- size=(width, height), position=(width + 20, 40),
- x=loc[:, 0], y=loc[:, 1], u=vec[:, 0],
- colormap=create_colormap1d_hot(size=128),
- keys='interactive')
- if sys.flags.interactive == 0:
- app.run()
diff --git a/examples/demo/gloo/voronoi.py b/examples/demo/gloo/voronoi.py
deleted file mode 100644
index 92e5359..0000000
--- a/examples/demo/gloo/voronoi.py
+++ /dev/null
@@ -1,119 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 30
-# vispy: testskip - because this example sometimes sets inactive attributes
-"""Computing a Voronoi diagram on the GPU. Shows how to use uniform arrays.
-
-Original version by Xavier Olive (xoolive).
-
-"""
-
-import numpy as np
-
-from vispy import app
-from vispy import gloo
-
-
-# Voronoi shaders.
-VS_voronoi = """
-attribute vec2 a_position;
-
-void main() {
- gl_Position = vec4(a_position, 0., 1.);
-}
-"""
-
-FS_voronoi = """
-uniform vec2 u_seeds[32];
-uniform vec3 u_colors[32];
-uniform vec2 u_screen;
-
-void main() {
- float dist = distance(u_screen * u_seeds[0], gl_FragCoord.xy);
- vec3 color = u_colors[0];
- for (int i = 1; i < 32; i++) {
- float current = distance(u_screen * u_seeds[i], gl_FragCoord.xy);
- if (current < dist) {
- color = u_colors[i];
- dist = current;
- }
- }
- gl_FragColor = vec4(color, 1.0);
-}
-"""
-
-
-# Seed point shaders.
-VS_seeds = """
-attribute vec2 a_position;
-uniform float u_ps;
-
-void main() {
- gl_Position = vec4(2. * a_position - 1., 0., 1.);
- gl_PointSize = 10. * u_ps;
-}
-"""
-
-FS_seeds = """
-varying vec3 v_color;
-void main() {
- gl_FragColor = vec4(1., 1., 1., 1.);
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(600, 600), title='Voronoi diagram',
- keys='interactive')
-
- self.ps = self.pixel_scale
-
- self.seeds = np.random.uniform(0, 1.0*self.ps,
- size=(32, 2)).astype(np.float32)
- self.colors = np.random.uniform(0.3, 0.8,
- size=(32, 3)).astype(np.float32)
-
- # Set Voronoi program.
- self.program_v = gloo.Program(VS_voronoi, FS_voronoi)
- self.program_v['a_position'] = [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
- # HACK: work-around a bug related to uniform arrays until
- # issue #345 is solved.
- for i in range(32):
- self.program_v['u_seeds[%d]' % i] = self.seeds[i, :]
- self.program_v['u_colors[%d]' % i] = self.colors[i, :]
-
- # Set seed points program.
- self.program_s = gloo.Program(VS_seeds, FS_seeds)
- self.program_s['a_position'] = self.seeds
- self.program_s['u_ps'] = self.ps
-
- self.activate_zoom()
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear()
- self.program_v.draw('triangle_strip')
- self.program_s.draw('points')
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- self.width, self.height = self.size
- gloo.set_viewport(0, 0, *self.physical_size)
- self.program_v['u_screen'] = (self.width, self.height)
-
- def on_mouse_move(self, event):
- x, y = event.pos
- x, y = x/float(self.width), 1-y/float(self.height)
- self.program_v['u_seeds[0]'] = x*self.ps, y*self.ps
- # TODO: just update the first line in the VBO instead of uploading the
- # whole array of seed points.
- self.seeds[0, :] = x, y
- self.program_s['a_position'].set_data(self.seeds)
- self.update()
-
-if __name__ == "__main__":
- c = Canvas()
- app.run()
diff --git a/examples/demo/scene/isocurve_for_trisurface_qt.py b/examples/demo/scene/isocurve_for_trisurface_qt.py
deleted file mode 100644
index 2fc2a92..0000000
--- a/examples/demo/scene/isocurve_for_trisurface_qt.py
+++ /dev/null
@@ -1,129 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-
-"""
-This example demonstrates isocurve for triangular mesh with vertex data and a
- qt interface.
-"""
-
-import sys
-import numpy as np
-
-from vispy import scene
-
-from vispy.geometry.generation import create_sphere
-from vispy.color.colormap import get_colormaps
-
-try:
- from sip import setapi
- setapi("QVariant", 2)
- setapi("QString", 2)
-except ImportError:
- pass
-
-from PyQt4 import QtGui, QtCore
-
-
-class ObjectWidget(QtGui.QWidget):
- """
- Widget for editing OBJECT parameters
- """
- signal_objet_changed = QtCore.pyqtSignal(name='objectChanged')
-
- def __init__(self, parent=None):
- super(ObjectWidget, self).__init__(parent)
-
- l_nbr_steps = QtGui.QLabel("Nbr Steps ")
- self.nbr_steps = QtGui.QSpinBox()
- self.nbr_steps.setMinimum(3)
- self.nbr_steps.setMaximum(100)
- self.nbr_steps.setValue(6)
- self.nbr_steps.valueChanged.connect(self.update_param)
-
- l_cmap = QtGui.QLabel("Cmap ")
- self.cmap = list(get_colormaps().keys())
- self.combo = QtGui.QComboBox(self)
- self.combo.addItems(self.cmap)
- self.combo.currentIndexChanged.connect(self.update_param)
-
- gbox = QtGui.QGridLayout()
- gbox.addWidget(l_cmap, 0, 0)
- gbox.addWidget(self.combo, 0, 1)
- gbox.addWidget(l_nbr_steps, 1, 0)
- gbox.addWidget(self.nbr_steps, 1, 1)
-
- vbox = QtGui.QVBoxLayout()
- vbox.addLayout(gbox)
- vbox.addStretch(1.0)
-
- self.setLayout(vbox)
-
- def update_param(self, option):
- self.signal_objet_changed.emit()
-
-
-class MainWindow(QtGui.QMainWindow):
-
- def __init__(self):
- QtGui.QMainWindow.__init__(self)
-
- self.resize(700, 500)
- self.setWindowTitle('vispy example ...')
-
- splitter = QtGui.QSplitter(QtCore.Qt.Horizontal)
-
- self.canvas = Canvas()
- self.canvas.create_native()
- self.canvas.native.setParent(self)
-
- self.props = ObjectWidget()
- splitter.addWidget(self.props)
- splitter.addWidget(self.canvas.native)
-
- self.setCentralWidget(splitter)
- self.props.signal_objet_changed.connect(self.update_view)
- self.update_view()
-
- def update_view(self):
- # banded, nbr_steps, cmap
- self.canvas.set_data(self.props.nbr_steps.value(),
- self.props.combo.currentText())
-
-
-class Canvas(scene.SceneCanvas):
-
- def __init__(self):
- scene.SceneCanvas.__init__(self, keys='interactive')
- self.size = 800, 600
- self.view = self.central_widget.add_view()
- self.view.camera = scene.TurntableCamera()
- self.radius = 2.0
- mesh = create_sphere(20, 20, radius=self.radius)
- vertices = mesh.get_vertices()
- tris = mesh.get_faces()
-
- cl = np.linspace(-self.radius, self.radius, 6 + 2)[1:-1]
-
- self.iso = scene.visuals.Isoline(vertices=vertices, tris=tris,
- data=vertices[:, 2],
- levels=cl, color_lev='autumn',
- parent=self.view.scene)
-
- # Add a 3D axis to keep us oriented
- scene.visuals.XYZAxis(parent=self.view.scene)
-
- def set_data(self, n_levels, cmap):
- self.iso.set_color(cmap)
- cl = np.linspace(-self.radius, self.radius, n_levels + 2)[1:-1]
- self.iso.set_levels(cl)
-
-
-# -----------------------------------------------------------------------------
-if __name__ == '__main__':
- appQt = QtGui.QApplication(sys.argv)
- win = MainWindow()
- win.show()
- appQt.exec_()
diff --git a/examples/demo/scene/magnify.py b/examples/demo/scene/magnify.py
deleted file mode 100644
index f844a5c..0000000
--- a/examples/demo/scene/magnify.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: gallery 10
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-""" Demonstrates use of special Camera subclasses to implement a (flashy)
-data-exploration tool.
-
-Here we use MagnifyCamera to allow the user to zoom in on a particular
-region of data, while also keeping the entire data set visible for reference.
-
-The MagnifyCamera classes are responsible for inserting MagnifyTransform
-at the transform of each viewbox scene, while also updating those transforms
-to respond to user input.
-"""
-
-import numpy as np
-import vispy.scene
-from vispy.scene import visuals
-from vispy.scene.cameras import MagnifyCamera, Magnify1DCamera
-from vispy.visuals.transforms import STTransform
-from vispy.util import filter
-
-#
-# Make a canvas and partition it into 3 viewboxes.
-#
-canvas = vispy.scene.SceneCanvas(keys='interactive', show=True)
-grid = canvas.central_widget.add_grid()
-
-vb1 = grid.add_view(row=0, col=0, col_span=2)
-vb2 = grid.add_view(row=1, col=0)
-vb3 = grid.add_view(row=1, col=1)
-
-#
-# Top viewbox: Show a plot line containing fine structure with a 1D
-# magnification transform.
-#
-
-
-pos = np.empty((100000, 2))
-pos[:, 0] = np.arange(100000)
-pos[:, 1] = np.random.normal(size=100000, loc=50, scale=10)
-pos[:, 1] = filter.gaussian_filter(pos[:, 1], 20)
-pos[:, 1] += np.random.normal(size=100000, loc=0, scale=2)
-pos[:, 1][pos[:, 1] > 55] += 100
-pos[:, 1] = filter.gaussian_filter(pos[:, 1], 2)
-line = visuals.Line(pos, color='white', parent=vb1.scene)
-line.transform = STTransform(translate=(0, 0, -0.1))
-
-grid1 = visuals.GridLines(parent=vb1.scene)
-
-vb1.camera = Magnify1DCamera(mag=4, size_factor=0.6, radius_ratio=0.6)
-vb1.camera.rect = 0, 30, 100000, 100
-
-#
-# Bottom-left viewbox: Image with circular magnification lens.
-#
-size = (100, 100)
-
-img_data = np.random.normal(size=size+(3,), loc=58, scale=20).astype(np.ubyte)
-image = visuals.Image(img_data, parent=vb2.scene, method='impostor')
-vb2.camera = MagnifyCamera(mag=3, size_factor=0.3, radius_ratio=0.6)
-vb2.camera.rect = (-10, -10, size[0]+20, size[1]+20)
-
-#
-# Bottom-right viewbox: Scatter plot with many clusters of varying scale.
-#
-
-
-centers = np.random.normal(size=(50, 2))
-pos = np.random.normal(size=(100000, 2), scale=0.2)
-indexes = np.random.normal(size=100000, loc=centers.shape[0]/2.,
- scale=centers.shape[0]/3.)
-indexes = np.clip(indexes, 0, centers.shape[0]-1).astype(int)
-scales = 10**(np.linspace(-2, 0.5, centers.shape[0]))[indexes][:, np.newaxis]
-pos *= scales
-pos += centers[indexes]
-
-scatter = visuals.Markers()
-scatter.set_data(pos, edge_color=None, face_color=(1, 1, 1, 0.3), size=5)
-vb3.add(scatter)
-
-grid2 = visuals.GridLines(parent=vb3.scene)
-vb3.camera = MagnifyCamera(mag=3, size_factor=0.3, radius_ratio=0.9)
-vb3.camera.rect = (-5, -5, 10, 10)
-
-# Add helpful text
-text1 = visuals.Text("mouse wheel = magnify", pos=(100, 15), font_size=14,
- color='white', parent=canvas.scene)
-text2 = visuals.Text("right button = zoom", pos=(100, 30), font_size=14,
- color='white', parent=canvas.scene)
-
-
-if __name__ == '__main__':
- import sys
- if sys.flags.interactive != 1:
- vispy.app.run()
diff --git a/examples/ipynb/colormaps.ipynb b/examples/ipynb/colormaps.ipynb
deleted file mode 100644
index e042c1a..0000000
--- a/examples/ipynb/colormaps.ipynb
+++ /dev/null
@@ -1,163 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# VisPy colormaps"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "This notebook illustrates the colormap API provided by VisPy."
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## List all colormaps"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "import numpy as np\n",
- "from vispy.color import (get_colormap, get_colormaps, Colormap)\n",
- "from IPython.display import display_html"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "for cmap in get_colormaps():\n",
- " display_html('<h3>%s</h3>' % cmap, raw=True)\n",
- " display_html(get_colormap(cmap))"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Discrete colormaps"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "Discrete colormaps can be created by giving a list of colors, and an optional list of control points (in $[0,1]$, the first and last points need to be $0$ and $1$ respectively). The colors can be specified in many ways (1-character shortcuts, hexadecimal values, arrays or RGB values, `ColorArray` instances, and so on)."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "Colormap(['r', 'g', 'b'], interpolation='zero')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "Colormap(['r', 'g', 'y'], interpolation='zero')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "Colormap(np.array([[0, .75, 0],\n",
- " [.75, .25, .5]]), \n",
- " [0., .25, 1.], \n",
- " interpolation='zero')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "Colormap(['r', 'g', '#123456'],\n",
- " interpolation='zero')"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Linear gradients"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "Colormap(['r', 'g', '#123456'])"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "Colormap([[1,0,0], [1,1,1], [1,0,1]], \n",
- " [0., .75, 1.])"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.4.2"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/examples/ipynb/webgl_example_1.ipynb b/examples/ipynb/webgl_example_1.ipynb
deleted file mode 100644
index d1c0575..0000000
--- a/examples/ipynb/webgl_example_1.ipynb
+++ /dev/null
@@ -1,211 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# WebGL backend demo"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "**WARNING: the WebGL backend requires IPython 3.0 (or the master branch of IPython until 3.0 is released)**"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "import numpy as np\n",
- "import vispy\n",
- "import vispy.gloo as gloo\n",
- "from vispy import app\n",
- "from vispy.util.transforms import perspective, translate, rotate\n",
- "app.use_app('ipynb_webgl');"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "n = 100\n",
- "a_position = np.random.uniform(-1, 1, (n, 3)).astype(np.float32)\n",
- "a_id = np.random.randint(0, 30, (n, 1))\n",
- "a_id = np.sort(a_id, axis=0).astype(np.float32)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "VERT_SHADER = \"\"\"\n",
- "uniform mat4 u_model;\n",
- "uniform mat4 u_view;\n",
- "uniform mat4 u_projection;\n",
- "attribute vec3 a_position;\n",
- "attribute float a_id;\n",
- "varying float v_id;\n",
- "void main (void) {\n",
- " v_id = a_id;\n",
- " gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);\n",
- "}\n",
- "\"\"\"\n",
- "\n",
- "FRAG_SHADER = \"\"\"\n",
- "varying float v_id;\n",
- "void main()\n",
- "{\n",
- " float f = fract(v_id);\n",
- " // The second useless test is needed on OSX 10.8 (fuck)\n",
- " if( (f > 0.0001) && (f < .9999) )\n",
- " discard;\n",
- " else\n",
- " gl_FragColor = vec4(0,0,0,1);\n",
- "}\n",
- "\"\"\""
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "class Canvas(app.Canvas):\n",
- "\n",
- " # ---------------------------------\n",
- " def __init__(self, size=None):\n",
- " app.Canvas.__init__(self, keys='interactive', size=size)\n",
- "\n",
- " self.program = gloo.Program(VERT_SHADER, FRAG_SHADER)\n",
- "\n",
- " # Set uniform and attribute\n",
- " self.program['a_id'] = gloo.VertexBuffer(a_id)\n",
- " self.program['a_position'] = gloo.VertexBuffer(a_position)\n",
- "\n",
- " self.translate = 5\n",
- " self.view = translate((0, 0, -self.translate), dtype=np.float32)\n",
- " self.model = np.eye(4, dtype=np.float32)\n",
- "\n",
- " gloo.set_viewport(0, 0, self.physical_size[0], self.physical_size[1])\n",
- " self.projection = perspective(45.0, self.size[0] /\n",
- " float(self.size[1]), 1.0, 1000.0)\n",
- " self.program['u_projection'] = self.projection\n",
- "\n",
- " self.program['u_model'] = self.model\n",
- " self.program['u_view'] = self.view\n",
- "\n",
- " self.theta = 0\n",
- " self.phi = 0\n",
- "\n",
- " self.context.set_clear_color('white')\n",
- " self.context.set_state('translucent')\n",
- "\n",
- " self.timer = app.Timer('auto', connect=self.on_timer, start=True)\n",
- "\n",
- " self.show()\n",
- "\n",
- " # ---------------------------------\n",
- " def on_key_press(self, event):\n",
- " if event.text == ' ':\n",
- " if self.timer.running:\n",
- " self.timer.stop()\n",
- " else:\n",
- " self.timer.start()\n",
- "\n",
- " # ---------------------------------\n",
- " def on_timer(self, event):\n",
- " self.theta += .5\n",
- " self.phi += .5\n",
- " self.model = np.dot(rotate(self.theta, (0, 0, 1)),\n",
- " rotate(self.phi, (0, 1, 0)))\n",
- " self.program['u_model'] = self.model\n",
- " self.update()\n",
- "\n",
- " # ---------------------------------\n",
- " def on_resize(self, event):\n",
- " gloo.set_viewport(0, 0, event.physical_size[0], event.physical_size[1])\n",
- " self.projection = perspective(45.0, event.size[0] /\n",
- " float(event.size[1]), 1.0, 1000.0)\n",
- " self.program['u_projection'] = self.projection\n",
- "\n",
- " # ---------------------------------\n",
- " def on_mouse_wheel(self, event):\n",
- " self.translate += event.delta[1]\n",
- " self.translate = max(2, self.translate)\n",
- " self.view = translate((0, 0, -self.translate))\n",
- " self.program['u_view'] = self.view\n",
- " self.update()\n",
- "\n",
- " # ---------------------------------\n",
- " def on_draw(self, event):\n",
- " self.context.clear()\n",
- " self.program.draw('line_strip')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "c = Canvas(size=(300, 300))\n",
- "#or\n",
- "#from vispy.app.backends.ipython import VispyWidget\n",
- "#w = VispyWidget()\n",
- "#w.set_canvas(c)\n",
- "#w"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "#c.timer.stop()"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.4.3"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/examples/ipynb/webgl_example_2.ipynb b/examples/ipynb/webgl_example_2.ipynb
deleted file mode 100644
index 3f4512f..0000000
--- a/examples/ipynb/webgl_example_2.ipynb
+++ /dev/null
@@ -1,270 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "# WebGL backend demo: molecular viewer in the notebook"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "**WARNING: the WebGL backend requires IPython 3.0 (or the master branch of IPython until 3.0 is released)**"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "import numpy as np\n",
- "\n",
- "from vispy import gloo\n",
- "from vispy import app\n",
- "from vispy.util.transforms import perspective, translate, rotate\n",
- "from vispy.io import load_data_file\n",
- "\n",
- "app.use_app('ipynb_webgl')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "vertex = \"\"\"\n",
- "uniform mat4 u_model;\n",
- "uniform mat4 u_view;\n",
- "uniform mat4 u_projection;\n",
- "uniform vec3 u_light_position;\n",
- "uniform vec3 u_light_spec_position;\n",
- "\n",
- "attribute vec3 a_position;\n",
- "attribute vec3 a_color;\n",
- "attribute float a_radius;\n",
- "\n",
- "varying vec3 v_color;\n",
- "varying vec4 v_eye_position;\n",
- "varying float v_radius;\n",
- "varying vec3 v_light_direction;\n",
- "\n",
- "void main (void) {\n",
- " v_radius = a_radius;\n",
- " v_color = a_color;\n",
- "\n",
- " v_eye_position = u_view * u_model * vec4(a_position,1.0);\n",
- " v_light_direction = normalize(u_light_position);\n",
- " float dist = length(v_eye_position.xyz);\n",
- "\n",
- " gl_Position = u_projection * v_eye_position;\n",
- "\n",
- " // stackoverflow.com/questions/8608844/...\n",
- " // ... resizing-point-sprites-based-on-distance-from-the-camera\n",
- " vec4 proj_corner = u_projection * vec4(a_radius, a_radius, v_eye_position.z, v_eye_position.w); // # noqa\n",
- " gl_PointSize = 512.0 * proj_corner.x / proj_corner.w;\n",
- "}\n",
- "\"\"\"\n",
- "\n",
- "fragment = \"\"\"\n",
- "uniform mat4 u_model;\n",
- "uniform mat4 u_view;\n",
- "uniform mat4 u_projection;\n",
- "uniform vec3 u_light_position;\n",
- "uniform vec3 u_light_spec_position;\n",
- "\n",
- "varying vec3 v_color;\n",
- "varying vec4 v_eye_position;\n",
- "varying float v_radius;\n",
- "varying vec3 v_light_direction;\n",
- "void main()\n",
- "{\n",
- " // r^2 = (x - x0)^2 + (y - y0)^2 + (z - z0)^2\n",
- " vec2 texcoord = gl_PointCoord* 2.0 - vec2(1.0);\n",
- " float x = texcoord.x;\n",
- " float y = texcoord.y;\n",
- " float d = 1.0 - x*x - y*y;\n",
- " if (d <= 0.0)\n",
- " discard;\n",
- "\n",
- " float z = sqrt(d);\n",
- " vec4 pos = v_eye_position;\n",
- " pos.z += v_radius*z;\n",
- " vec3 pos2 = pos.xyz;\n",
- " pos = u_projection * pos;\n",
- " //gl_FragDepth = 0.5*(pos.z / pos.w)+0.5;\n",
- " vec3 normal = vec3(x,y,z);\n",
- " float diffuse = clamp(dot(normal, v_light_direction), 0.0, 1.0);\n",
- "\n",
- " // Specular lighting.\n",
- " vec3 M = pos2.xyz;\n",
- " vec3 O = v_eye_position.xyz;\n",
- " vec3 L = u_light_spec_position;\n",
- " vec3 K = normalize(normalize(L - M) + normalize(O - M));\n",
- " // WARNING: abs() is necessary, otherwise weird bugs may appear with some\n",
- " // GPU drivers...\n",
- " float specular = clamp(pow(abs(dot(normal, K)), 40.), 0.0, 1.0);\n",
- " vec3 v_light = vec3(1., 1., 1.);\n",
- " gl_FragColor.rgb = (.15*v_color + .55*diffuse * v_color\n",
- " + .35*specular * v_light);\n",
- "}\n",
- "\"\"\""
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "class Canvas(app.Canvas):\n",
- "\n",
- " def __init__(self):\n",
- " app.Canvas.__init__(self, title='Molecular viewer',\n",
- " keys='interactive', size=(640, 480))\n",
- " self.ps = self.pixel_scale\n",
- "\n",
- " self.translate = 40\n",
- " self.program = gloo.Program(vertex, fragment)\n",
- " self.view = translate((0, 0, -self.translate))\n",
- " self.model = np.eye(4, dtype=np.float32)\n",
- " self.projection = np.eye(4, dtype=np.float32)\n",
- "\n",
- " self.apply_zoom()\n",
- "\n",
- " fname = load_data_file('molecular_viewer/micelle.npz')\n",
- " self.load_molecule(fname)\n",
- " self.load_data()\n",
- "\n",
- " self.theta = 0\n",
- " self.phi = 0\n",
- "\n",
- " gloo.set_state(depth_test=True, clear_color='black')\n",
- " self._timer = app.Timer('auto', connect=self.on_timer, start=True)\n",
- "\n",
- " self.show()\n",
- "\n",
- " def load_molecule(self, fname):\n",
- " molecule = np.load(fname)['molecule']\n",
- " self._nAtoms = molecule.shape[0]\n",
- "\n",
- " # The x,y,z values store in one array\n",
- " self.coords = molecule[:, :3]\n",
- "\n",
- " # The array that will store the color and alpha scale for all the atoms\n",
- " self.atomsColours = molecule[:, 3:6]\n",
- "\n",
- " # The array that will store the scale for all the atoms.\n",
- " self.atomsScales = molecule[:, 6]\n",
- "\n",
- " def load_data(self):\n",
- " n = self._nAtoms\n",
- "\n",
- " data = np.zeros(n, [('a_position', np.float32, 3),\n",
- " ('a_color', np.float32, 3),\n",
- " ('a_radius', np.float32, 1)])\n",
- "\n",
- " data['a_position'] = self.coords\n",
- " data['a_color'] = self.atomsColours\n",
- " data['a_radius'] = self.atomsScales*self.ps\n",
- "\n",
- " self.program.bind(gloo.VertexBuffer(data))\n",
- "\n",
- " self.program['u_model'] = self.model\n",
- " self.program['u_view'] = self.view\n",
- " self.program['u_light_position'] = 0., 0., 2.\n",
- " self.program['u_light_spec_position'] = -5., 5., -5.\n",
- "\n",
- " def on_key_press(self, event):\n",
- " if event.text == ' ':\n",
- " if self.timer.running:\n",
- " self.timer.stop()\n",
- " else:\n",
- " self.timer.start()\n",
- " # if event.text == 'A':\n",
- " # self.\n",
- "\n",
- " def on_timer(self, event):\n",
- " self.theta += .25\n",
- " self.phi += .25\n",
- " self.model = np.dot(rotate(self.theta, (0, 0, 1)),\n",
- " rotate(self.phi, (0, 1, 0)))\n",
- " self.program['u_model'] = self.model\n",
- " self.update()\n",
- "\n",
- " def on_resize(self, event):\n",
- " width, height = event.size\n",
- "\n",
- " def apply_zoom(self):\n",
- " width, height = self.physical_size\n",
- " gloo.set_viewport(0, 0, width, height)\n",
- " self.projection = perspective(25.0, width / float(height), 2.0, 100.0)\n",
- " self.program['u_projection'] = self.projection\n",
- "\n",
- " def on_mouse_wheel(self, event):\n",
- " self.translate -= event.delta[1]\n",
- " self.translate = max(-1, self.translate)\n",
- " self.view = translate((0, 0, -self.translate))\n",
- "\n",
- " self.program['u_view'] = self.view\n",
- " self.update()\n",
- "\n",
- " def on_draw(self, event):\n",
- " gloo.clear()\n",
- " self.program.draw('points')\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": true
- },
- "outputs": [],
- "source": [
- "c = Canvas()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "collapsed": false
- },
- "outputs": [],
- "source": [
- "#c._timer.stop()"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.4.3"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/examples/tutorial/app/app_events.py b/examples/tutorial/app/app_events.py
deleted file mode 100644
index 8a00957..0000000
--- a/examples/tutorial/app/app_events.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-"""
-This example shows how to retrieve event information from a callback.
-You should see information displayed for any event you triggered.
-"""
-
-from vispy import gloo, app, use
-use('pyqt4') # can be another app backend name
-
-
-class Canvas(app.Canvas):
-
- def __init__(self, *args, **kwargs):
- app.Canvas.__init__(self, *args, **kwargs)
- self.title = 'App demo'
-
- def on_close(self, event):
- print('closing!')
-
- def on_resize(self, event):
- print('Resize %r' % (event.size, ))
-
- def on_key_press(self, event):
- modifiers = [key.name for key in event.modifiers]
- print('Key pressed - text: %r, key: %s, modifiers: %r' % (
- event.text, event.key.name, modifiers))
-
- def on_key_release(self, event):
- modifiers = [key.name for key in event.modifiers]
- print('Key released - text: %r, key: %s, modifiers: %r' % (
- event.text, event.key.name, modifiers))
-
- def on_mouse_press(self, event):
- self.print_mouse_event(event, 'Mouse press')
-
- def on_mouse_release(self, event):
- self.print_mouse_event(event, 'Mouse release')
-
- def on_mouse_move(self, event):
- if (event.pos[0] < self.size[0] * 0.5 and
- event.pos[1] < self.size[1] * 0.5):
- self.print_mouse_event(event, 'Mouse move')
-
- def on_mouse_wheel(self, event):
- self.print_mouse_event(event, 'Mouse wheel')
-
- def print_mouse_event(self, event, what):
- modifiers = ', '.join([key.name for key in event.modifiers])
- print('%s - pos: %r, button: %s, modifiers: %s, delta: %r' %
- (what, event.pos, event.button, modifiers, event.delta))
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
-
-
-if __name__ == '__main__':
- canvas = Canvas(keys='interactive')
- canvas.show()
- app.run()
diff --git a/examples/tutorial/app/fps.py b/examples/tutorial/app/fps.py
deleted file mode 100644
index 1fcf1cd..0000000
--- a/examples/tutorial/app/fps.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-"""
-This is a very minimal example that opens a window and makes the background
-color to change from black to white to black ...
-
-The backend is chosen automatically depending on what is available on
-your machine.
-"""
-
-import math
-from vispy import app, gloo
-
-
-class Canvas(app.Canvas):
-
- def __init__(self, *args, **kwargs):
- app.Canvas.__init__(self, *args, **kwargs)
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
- self.tick = 0
- self.show()
-
- def on_draw(self, event):
- gloo.clear(color=True)
-
- def on_timer(self, event):
- self.tick += 1 / 60.0
- c = abs(math.sin(self.tick))
- gloo.set_clear_color((c, c, c, 1))
- self.update()
-
- def show_fps(self, fps):
- print("FPS - %.2f" % fps)
-
-if __name__ == '__main__':
- canvas = Canvas(keys='interactive')
- canvas.measure_fps(1, canvas.show_fps)
- app.run()
diff --git a/examples/tutorial/app/interactive.py b/examples/tutorial/app/interactive.py
deleted file mode 100644
index 4742080..0000000
--- a/examples/tutorial/app/interactive.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-"""
-This example shows how to configure VisPy to run from IPython (or Python) in
-interactive mode, while simultaneously updating the VisPy event loop. This
-behavior is supported by default in all code that calls vispy.app.run(), but
-here it's setup manually.
-
-Run this file with `ipython -i interactive.py` to get a console and a window.
-"""
-
-import math
-from vispy import app, gloo
-from vispy.color import Color
-
-
-class Canvas(app.Canvas):
-
- def __init__(self, *args, **kwargs):
- app.Canvas.__init__(self, *args, **kwargs)
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
- self.color = 'white'
-
- def on_draw(self, event):
- gloo.clear(color=True)
-
- def on_timer(self, event):
- # Animation speed based on global time.
- t = event.elapsed
- c = Color(self.color).rgb
- # Simple sinusoid wave animation.
- s = abs(0.5 + 0.5 * math.sin(t))
- gloo.set_clear_color((c[0] * s, c[1] * s, c[2] * s, 1))
- self.update()
-
-
-# You should run this demo as main with ipython -i <file>. If interactive
-# mode is not specified, this demo will exit immediately because this demo
-# doesn't call run and relies on the input hook being setup.
-if __name__ == '__main__':
- from vispy import app
- # app.use_app('glfw') # for testing specific backends
- app.set_interactive()
-
-
-# All variables listed in this scope are accessible via the console.
-canvas = Canvas(keys='interactive')
-canvas.show()
-
-
-# In IPython, try typing any of the following:
-# >>> canvas.color = (1.0, 0.0, 0.0)
-# >>> canvas.color = 'red'
diff --git a/examples/tutorial/app/shared_context.py b/examples/tutorial/app/shared_context.py
deleted file mode 100644
index f631da2..0000000
--- a/examples/tutorial/app/shared_context.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-"""
-This is a very simple example that demonstrates using a shared context
-between two Qt widgets.
-"""
-
-from PyQt4 import QtGui, QtCore # can also use pyside
-from functools import partial
-
-from vispy.app import Timer
-from vispy.scene.visuals import Text
-from vispy.scene.widgets import ViewBox
-from vispy.scene import SceneCanvas
-
-
-def on_resize(canvas, vb, event):
- vb.pos = 1, 1
- vb.size = (canvas.size[0] - 2, canvas.size[1] - 2)
-
-
-class Window(QtGui.QWidget):
- def __init__(self):
- super(Window, self).__init__()
- box = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self)
- self.resize(500, 200)
- self.setLayout(box)
-
- self.canvas_0 = SceneCanvas(bgcolor='w')
- self.vb_0 = ViewBox(parent=self.canvas_0.scene, bgcolor='r')
- self.vb_0.camera.rect = -1, -1, 2, 2
- self.canvas_0.events.initialize.connect(self.on_init)
- self.canvas_0.events.resize.connect(partial(on_resize,
- self.canvas_0,
- self.vb_0))
- box.addWidget(self.canvas_0.native)
-
- # pass the context from the first canvas to the second
- self.canvas_1 = SceneCanvas(bgcolor='w', shared=self.canvas_0.context)
- self.vb_1 = ViewBox(parent=self.canvas_1.scene, bgcolor='b')
- self.vb_1.camera.rect = -1, -1, 2, 2
- self.canvas_1.events.resize.connect(partial(on_resize,
- self.canvas_1,
- self.vb_1))
- box.addWidget(self.canvas_1.native)
-
- self.tick_count = 0
- self.timer = Timer(interval=1., connect=self.on_timer, start=True)
- self.setWindowTitle('Shared contexts')
- self.show()
-
- def on_init(self, event):
- self.text = Text('Initialized', font_size=40.,
- parent=[self.vb_0.scene, self.vb_1.scene])
-
- def on_timer(self, event):
- self.tick_count += 1
- self.text.text = 'Tick #%s' % self.tick_count
- self.canvas_0.update()
- self.canvas_1.update()
-
- def keyPressEvent(self, event):
- if event.key() == QtCore.Qt.Key_Escape:
- self.close()
- elif event.key() == QtCore.Qt.Key_F11:
- self.showNormal() if self.isFullScreen() else self.showFullScreen()
-
-if __name__ == '__main__':
- qt_app = QtGui.QApplication([])
- ex = Window()
- qt_app.exec_()
diff --git a/examples/tutorial/app/simple.py b/examples/tutorial/app/simple.py
deleted file mode 100644
index d56c5ad..0000000
--- a/examples/tutorial/app/simple.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-"""
-This is a very minimal example that opens a window and makes the background
-color to change from black to white to black ...
-
-The backend is chosen automatically depending on what is available on
-your machine.
-"""
-
-import math
-from vispy import app, gloo
-
-
-class Canvas(app.Canvas):
-
- def __init__(self, *args, **kwargs):
- app.Canvas.__init__(self, *args, **kwargs)
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
- self.tick = 0
-
- def on_draw(self, event):
- gloo.clear(color=True)
-
- def on_timer(self, event):
- self.tick += 1 / 60.0
- c = abs(math.sin(self.tick))
- gloo.set_clear_color((c, c, c, 1))
- self.update()
-
-if __name__ == '__main__':
- canvas = Canvas(keys='interactive', always_on_top=True)
- canvas.show()
- app.run()
diff --git a/examples/tutorial/app/simple_wx.py b/examples/tutorial/app/simple_wx.py
deleted file mode 100644
index 8a16d12..0000000
--- a/examples/tutorial/app/simple_wx.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-# vispy: testskip
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-"""
-This is a very minimal example that opens a window and makes the background
-color to change from black to white to black ...
-
-The wx backend is used to embed the canvas in a simple wx Frame with
-a menubar.
-"""
-
-import wx
-import math
-from vispy import app, gloo
-
-
-class Canvas(app.Canvas):
- def __init__(self, *args, **kwargs):
- app.Canvas.__init__(self, *args, **kwargs)
- self._timer = app.Timer('auto', connect=self.on_timer, start=True)
- self.tick = 0
-
- def on_draw(self, event):
- gloo.clear(color=True)
-
- def on_timer(self, event):
- self.tick += 1 / 60.0
- c = abs(math.sin(self.tick))
- gloo.set_clear_color((c, c, c, 1))
- self.update()
-
-
-class TestFrame(wx.Frame):
- def __init__(self):
- wx.Frame.__init__(self, None, -1, "Vispy Test",
- wx.DefaultPosition, size=(500, 500))
-
- MenuBar = wx.MenuBar()
- file_menu = wx.Menu()
- file_menu.Append(wx.ID_EXIT, "&Quit")
- self.Bind(wx.EVT_MENU, self.on_quit, id=wx.ID_EXIT)
- MenuBar.Append(file_menu, "&File")
- self.SetMenuBar(MenuBar)
-
- self.canvas = Canvas(app="wx", parent=self)
- self.canvas.native.Show()
-
- def on_quit(self, event):
- self.Close(True)
-
-if __name__ == '__main__':
- myapp = wx.App(0)
- frame = TestFrame()
- frame.Show(True)
- myapp.MainLoop()
diff --git a/examples/tutorial/gl/cube.py b/examples/tutorial/gl/cube.py
deleted file mode 100644
index 5d57b4e..0000000
--- a/examples/tutorial/gl/cube.py
+++ /dev/null
@@ -1,233 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# -----------------------------------------------------------------------------
-import math
-import numpy as np
-
-from vispy import app
-from vispy.gloo import gl
-
-
-def checkerboard(grid_num=8, grid_size=32):
- row_even = grid_num // 2 * [0, 1]
- row_odd = grid_num // 2 * [1, 0]
- Z = np.row_stack(grid_num // 2 * (row_even, row_odd)).astype(np.uint8)
- return 255 * Z.repeat(grid_size, axis=0).repeat(grid_size, axis=1)
-
-
-def rotate(M, angle, x, y, z, point=None):
- angle = math.pi * angle / 180
- c, s = math.cos(angle), math.sin(angle)
- n = math.sqrt(x * x + y * y + z * z)
- x /= n
- y /= n
- z /= n
- cx, cy, cz = (1 - c) * x, (1 - c) * y, (1 - c) * z
- R = np.array([[cx * x + c, cy * x - z * s, cz * x + y * s, 0],
- [cx * y + z * s, cy * y + c, cz * y - x * s, 0],
- [cx * z - y * s, cy * z + x * s, cz * z + c, 0],
- [0, 0, 0, 1]], dtype=M.dtype).T
- M[...] = np.dot(M, R)
- return M
-
-
-def translate(M, x, y=None, z=None):
- y = x if y is None else y
- z = x if z is None else z
- T = np.array([[1.0, 0.0, 0.0, x],
- [0.0, 1.0, 0.0, y],
- [0.0, 0.0, 1.0, z],
- [0.0, 0.0, 0.0, 1.0]], dtype=M.dtype).T
- M[...] = np.dot(M, T)
- return M
-
-
-def frustum(left, right, bottom, top, znear, zfar):
- M = np.zeros((4, 4), dtype=np.float32)
- M[0, 0] = +2.0 * znear / (right - left)
- M[2, 0] = (right + left) / (right - left)
- M[1, 1] = +2.0 * znear / (top - bottom)
- M[3, 1] = (top + bottom) / (top - bottom)
- M[2, 2] = -(zfar + znear) / (zfar - znear)
- M[3, 2] = -2.0 * znear * zfar / (zfar - znear)
- M[2, 3] = -1.0
- return M
-
-
-def perspective(fovy, aspect, znear, zfar):
- h = math.tan(fovy / 360.0 * math.pi) * znear
- w = h * aspect
- return frustum(-w, w, -h, h, znear, zfar)
-
-
-def makecube():
- """ Generate vertices & indices for a filled cube """
-
- vtype = [('a_position', np.float32, 3),
- ('a_texcoord', np.float32, 2)]
- itype = np.uint32
-
- # Vertices positions
- p = np.array([[1, 1, 1], [-1, 1, 1], [-1, -1, 1], [1, -1, 1],
- [1, -1, -1], [1, 1, -1], [-1, 1, -1], [-1, -1, -1]])
-
- # Texture coords
- t = np.array([[0, 0], [0, 1], [1, 1], [1, 0]])
-
- faces_p = [0, 1, 2, 3, 0, 3, 4, 5, 0, 5, 6,
- 1, 1, 6, 7, 2, 7, 4, 3, 2, 4, 7, 6, 5]
- faces_t = [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2,
- 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3]
-
- vertices = np.zeros(24, vtype)
- vertices['a_position'] = p[faces_p]
- vertices['a_texcoord'] = t[faces_t]
-
- indices = np.resize(
- np.array([0, 1, 2, 0, 2, 3], dtype=itype), 6 * (2 * 3))
- indices += np.repeat(4 * np.arange(6), 6).astype(np.uint32)
-
- return vertices, indices
-
-
-cube_vertex = """
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-attribute vec3 a_position;
-attribute vec2 a_texcoord;
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = u_projection * u_view * u_model * vec4(a_position,1.0);
- v_texcoord = a_texcoord;
-}
-"""
-
-cube_fragment = """
-uniform sampler2D u_texture;
-varying vec2 v_texcoord;
-void main()
-{
- gl_FragColor = texture2D(u_texture, v_texcoord);
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512),
- title='Rotating cube (GL version)',
- keys='interactive')
-
- def on_initialize(self, event):
- # Build & activate cube program
- self.cube = gl.glCreateProgram()
- vertex = gl.glCreateShader(gl.GL_VERTEX_SHADER)
- fragment = gl.glCreateShader(gl.GL_FRAGMENT_SHADER)
- gl.glShaderSource(vertex, cube_vertex)
- gl.glShaderSource(fragment, cube_fragment)
- gl.glCompileShader(vertex)
- gl.glCompileShader(fragment)
- gl.glAttachShader(self.cube, vertex)
- gl.glAttachShader(self.cube, fragment)
- gl.glLinkProgram(self.cube)
- gl.glDetachShader(self.cube, vertex)
- gl.glDetachShader(self.cube, fragment)
- gl.glUseProgram(self.cube)
-
- # Get data & build cube buffers
- vcube_data, self.icube_data = makecube()
- vcube = gl.glCreateBuffer()
- gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vcube)
- gl.glBufferData(gl.GL_ARRAY_BUFFER, vcube_data, gl.GL_STATIC_DRAW)
- icube = gl.glCreateBuffer()
- gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, icube)
- gl.glBufferData(gl.GL_ELEMENT_ARRAY_BUFFER,
- self.icube_data, gl.GL_STATIC_DRAW)
-
- # Bind cube attributes
- stride = vcube_data.strides[0]
- offset = 0
- loc = gl.glGetAttribLocation(self.cube, "a_position")
- gl.glEnableVertexAttribArray(loc)
- gl.glVertexAttribPointer(loc, 3, gl.GL_FLOAT, False, stride, offset)
-
- offset = vcube_data.dtype["a_position"].itemsize
- loc = gl.glGetAttribLocation(self.cube, "a_texcoord")
- gl.glEnableVertexAttribArray(loc)
- gl.glVertexAttribPointer(loc, 2, gl.GL_FLOAT, False, stride, offset)
-
- # Create & bind cube texture
- crate = checkerboard()
- texture = gl.glCreateTexture()
- gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER,
- gl.GL_LINEAR)
- gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER,
- gl.GL_LINEAR)
- gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_S,
- gl.GL_CLAMP_TO_EDGE)
- gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_T,
- gl.GL_CLAMP_TO_EDGE)
- gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_LUMINANCE, gl.GL_LUMINANCE,
- gl.GL_UNSIGNED_BYTE, crate.shape[:2])
- gl.glTexSubImage2D(gl.GL_TEXTURE_2D, 0, 0, 0, gl.GL_LUMINANCE,
- gl.GL_UNSIGNED_BYTE, crate)
- loc = gl.glGetUniformLocation(self.cube, "u_texture")
- gl.glUniform1i(loc, texture)
- gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
-
- # Create & bind cube matrices
- view = np.eye(4, dtype=np.float32)
- model = np.eye(4, dtype=np.float32)
- projection = np.eye(4, dtype=np.float32)
- translate(view, 0, 0, -7)
- self.phi, self.theta = 60, 20
- rotate(model, self.theta, 0, 0, 1)
- rotate(model, self.phi, 0, 1, 0)
- loc = gl.glGetUniformLocation(self.cube, "u_model")
- gl.glUniformMatrix4fv(loc, 1, False, model)
- loc = gl.glGetUniformLocation(self.cube, "u_view")
- gl.glUniformMatrix4fv(loc, 1, False, view)
- loc = gl.glGetUniformLocation(self.cube, "u_projection")
- gl.glUniformMatrix4fv(loc, 1, False, projection)
-
- # OpenGL initalization
- gl.glClearColor(0.30, 0.30, 0.35, 1.00)
- gl.glEnable(gl.GL_DEPTH_TEST)
- self._resize(*(self.size + self.physical_size))
- self.timer = app.Timer('auto', self.on_timer, start=True)
-
- def on_draw(self, event):
- gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
- gl.glDrawElements(gl.GL_TRIANGLES, self.icube_data.size,
- gl.GL_UNSIGNED_INT, None)
-
- def on_resize(self, event):
- self._resize(*(event.size + event.physical_size))
-
- def _resize(self, width, height, physical_width, physical_height):
- gl.glViewport(0, 0, physical_width, physical_height)
- projection = perspective(35.0, width / float(height), 2.0, 10.0)
- loc = gl.glGetUniformLocation(self.cube, "u_projection")
- gl.glUniformMatrix4fv(loc, 1, False, projection)
-
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- model = np.eye(4, dtype=np.float32)
- rotate(model, self.theta, 0, 0, 1)
- rotate(model, self.phi, 0, 1, 0)
- loc = gl.glGetUniformLocation(self.cube, "u_model")
- gl.glUniformMatrix4fv(loc, 1, False, model)
- self.update()
-
-if __name__ == '__main__':
- c = Canvas()
- c.show()
- app.run()
diff --git a/examples/tutorial/gl/fireworks.py b/examples/tutorial/gl/fireworks.py
deleted file mode 100644
index a696b1a..0000000
--- a/examples/tutorial/gl/fireworks.py
+++ /dev/null
@@ -1,159 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Almar Klein & Nicolas P .Rougier
-# Date: 04/03/2014
-# Topic: Fireworks !
-# Keywords: oarticles, gl, sprites
-# -----------------------------------------------------------------------------
-"""
-Example demonstrating simulation of fireworks using point sprites.
-(adapted from the "OpenGL ES 2.0 Programming Guide")
-
-This example demonstrates a series of explosions that last one second. The
-visualization during the explosion is highly optimized using a Vertex Buffer
-Object (VBO). After each explosion, vertex data for the next explosion are
-calculated, such that each explostion is unique.
-"""
-import numpy as np
-
-from vispy import app
-from vispy.gloo import gl
-
-
-vertex_code = """
-#version 120
-
-uniform float time;
-uniform vec3 center;
-attribute float lifetime;
-attribute vec3 start;
-attribute vec3 end;
-varying float v_lifetime;
-void main () {
- if (time < lifetime) {
- gl_Position.xyz = start + (time * end) + center;
- gl_Position.w = 1.0;
- gl_Position.y -= 1.5 * time * time;
- } else {
- gl_Position = vec4(-1000, -1000, 0, 0);
- }
- v_lifetime = clamp(1.0 - (time / lifetime), 0.0, 1.0);
- gl_PointSize = (v_lifetime * v_lifetime) * 40.0;
-}
-"""
-
-fragment_code = """
-#version 120
-
-uniform vec4 color;
-varying float v_lifetime;
-void main()
-{
- float d = 1 - length(gl_PointCoord - vec2(.5,.5)) / (sqrt(2)/2);
- gl_FragColor = d*color;
- gl_FragColor.a = d;
- gl_FragColor.a *= v_lifetime;
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(800, 600), title='GL Fireworks',
- keys='interactive')
-
- def on_initialize(self, event):
- # Build & activate program
- self.program = gl.glCreateProgram()
- vertex = gl.glCreateShader(gl.GL_VERTEX_SHADER)
- fragment = gl.glCreateShader(gl.GL_FRAGMENT_SHADER)
- gl.glShaderSource(vertex, vertex_code)
- gl.glShaderSource(fragment, fragment_code)
- gl.glCompileShader(vertex)
- gl.glCompileShader(fragment)
- gl.glAttachShader(self.program, vertex)
- gl.glAttachShader(self.program, fragment)
- gl.glLinkProgram(self.program)
- gl.glDetachShader(self.program, vertex)
- gl.glDetachShader(self.program, fragment)
- gl.glUseProgram(self.program)
-
- # Build vertex buffer
- n = 10000
- self.data = np.zeros(n, dtype=[('lifetime', np.float32, 1),
- ('start', np.float32, 3),
- ('end', np.float32, 3)])
- vbuffer = gl.glCreateBuffer()
- gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vbuffer)
- gl.glBufferData(gl.GL_ARRAY_BUFFER, self.data, gl.GL_DYNAMIC_DRAW)
-
- # Bind buffer attributes
- stride = self.data.strides[0]
-
- offset = 0
- loc = gl.glGetAttribLocation(self.program, "lifetime")
- gl.glEnableVertexAttribArray(loc)
- gl.glVertexAttribPointer(loc, 1, gl.GL_FLOAT, False, stride, offset)
-
- offset = self.data.dtype["lifetime"].itemsize
- loc = gl.glGetAttribLocation(self.program, "start")
- gl.glEnableVertexAttribArray(loc)
- gl.glVertexAttribPointer(loc, 3, gl.GL_FLOAT, False, stride, offset)
-
- offset = self.data.dtype["start"].itemsize
- loc = gl.glGetAttribLocation(self.program, "end")
- gl.glEnableVertexAttribArray(loc)
- gl.glVertexAttribPointer(loc, 3, gl.GL_FLOAT, False, stride, offset)
-
- # OpenGL initalization
- self.elapsed_time = 0
- gl.glClearColor(0, 0, 0, 1)
- gl.glDisable(gl.GL_DEPTH_TEST)
- gl.glEnable(gl.GL_BLEND)
- gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE)
- gl.glEnable(34370) # gl.GL_VERTEX_PROGRAM_POINT_SIZE
- gl.glEnable(34913) # gl.GL_POINT_SPRITE
- gl.glViewport(0, 0, *self.physical_size)
- self.new_explosion()
- self.timer = app.Timer('auto', self.on_timer, start=True)
-
- def on_draw(self, event):
- gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
- gl.glDrawArrays(gl.GL_POINTS, 0, len(self.data))
-
- def on_resize(self, event):
- gl.glViewport(0, 0, *event.physical_size)
-
- def on_timer(self, event):
- self.elapsed_time += 1. / 60.
- if self.elapsed_time > 1.5:
- self.new_explosion()
- self.elapsed_time = 0.0
-
- loc = gl.glGetUniformLocation(self.program, "time")
- gl.glUniform1f(loc, self.elapsed_time)
- self.update()
-
- def new_explosion(self):
- n = len(self.data)
- color = np.random.uniform(0.1, 0.9, 4).astype(np.float32)
- color[3] = 1.0 / n ** 0.08
- loc = gl.glGetUniformLocation(self.program, "color")
- gl.glUniform4f(loc, *color)
-
- center = np.random.uniform(-0.5, 0.5, 3)
- loc = gl.glGetUniformLocation(self.program, "center")
- gl.glUniform3f(loc, *center)
-
- self.data['lifetime'] = np.random.normal(2.0, 0.5, (n,))
- self.data['start'] = np.random.normal(0.0, 0.2, (n, 3))
- self.data['end'] = np.random.normal(0.0, 1.2, (n, 3))
- gl.glBufferData(gl.GL_ARRAY_BUFFER, self.data, gl.GL_DYNAMIC_DRAW)
-
-if __name__ == '__main__':
- c = Canvas()
- c.show()
- app.run()
diff --git a/examples/tutorial/gl/quad.py b/examples/tutorial/gl/quad.py
deleted file mode 100644
index d9d1cd8..0000000
--- a/examples/tutorial/gl/quad.py
+++ /dev/null
@@ -1,116 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# -----------------------------------------------------------------------------
-import numpy as np
-
-from vispy import app
-from vispy.gloo import gl
-
-vertex_code = """
- uniform float scale;
- attribute vec4 color;
- attribute vec2 position;
- varying vec4 v_color;
- void main()
- {
- gl_Position = vec4(scale*position, 0.0, 1.0);
- v_color = color;
- } """
-
-fragment_code = """
- varying vec4 v_color;
- void main()
- {
- gl_FragColor = v_color;
- } """
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512), title='Quad (GL)',
- keys='interactive')
-
- def on_initialize(self, event):
- # Build data
- self.data = np.zeros(4, [("position", np.float32, 2),
- ("color", np.float32, 4)])
- self.data['color'] = [(1, 0, 0, 1), (0, 1, 0, 1),
- (0, 0, 1, 1), (1, 1, 0, 1)]
- self.data['position'] = [(-1, -1), (-1, +1),
- (+1, -1), (+1, +1)]
-
- # Build & activate program
-
- # Request a program and shader slots from GPU
- program = gl.glCreateProgram()
- vertex = gl.glCreateShader(gl.GL_VERTEX_SHADER)
- fragment = gl.glCreateShader(gl.GL_FRAGMENT_SHADER)
-
- # Set shaders source
- gl.glShaderSource(vertex, vertex_code)
- gl.glShaderSource(fragment, fragment_code)
-
- # Compile shaders
- gl.glCompileShader(vertex)
- gl.glCompileShader(fragment)
-
- # Attach shader objects to the program
- gl.glAttachShader(program, vertex)
- gl.glAttachShader(program, fragment)
-
- # Build program
- gl.glLinkProgram(program)
-
- # Get rid of shaders (no more needed)
- gl.glDetachShader(program, vertex)
- gl.glDetachShader(program, fragment)
-
- # Make program the default program
- gl.glUseProgram(program)
-
- # Build buffer
-
- # Request a buffer slot from GPU
- buf = gl.glCreateBuffer()
-
- # Make this buffer the default one
- gl.glBindBuffer(gl.GL_ARRAY_BUFFER, buf)
-
- # Upload data
- gl.glBufferData(gl.GL_ARRAY_BUFFER, self.data, gl.GL_DYNAMIC_DRAW)
-
- # Bind attributes
- stride = self.data.strides[0]
- offset = 0
- loc = gl.glGetAttribLocation(program, "position")
- gl.glEnableVertexAttribArray(loc)
- gl.glBindBuffer(gl.GL_ARRAY_BUFFER, buf)
- gl.glVertexAttribPointer(loc, 3, gl.GL_FLOAT, False, stride, offset)
-
- offset = self.data.dtype["position"].itemsize
- loc = gl.glGetAttribLocation(program, "color")
- gl.glEnableVertexAttribArray(loc)
- gl.glBindBuffer(gl.GL_ARRAY_BUFFER, buf)
- gl.glVertexAttribPointer(loc, 4, gl.GL_FLOAT, False, stride, offset)
-
- # Bind uniforms
- # --------------------------------------
- loc = gl.glGetUniformLocation(program, "scale")
- gl.glUniform1f(loc, 1.0)
-
- def on_draw(self, event):
- gl.glClear(gl.GL_COLOR_BUFFER_BIT)
- gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4)
-
- def on_resize(self, event):
- gl.glViewport(0, 0, *event.physical_size)
-
-if __name__ == '__main__':
- c = Canvas()
- c.show()
- app.run()
diff --git a/examples/tutorial/gloo/colored_cube.py b/examples/tutorial/gloo/colored_cube.py
deleted file mode 100644
index 9e08b08..0000000
--- a/examples/tutorial/gloo/colored_cube.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# -----------------------------------------------------------------------------
-
-import numpy as np
-
-from vispy import app, gloo
-from vispy.gloo import Program, VertexBuffer, IndexBuffer
-from vispy.util.transforms import perspective, translate, rotate
-from vispy.geometry import create_cube
-
-
-vertex = """
-uniform mat4 model;
-uniform mat4 view;
-uniform mat4 projection;
-
-attribute vec3 position;
-attribute vec2 texcoord;
-attribute vec3 normal;
-attribute vec4 color;
-
-varying vec4 v_color;
-void main()
-{
- v_color = color;
- gl_Position = projection * view * model * vec4(position,1.0);
-}
-"""
-
-fragment = """
-varying vec4 v_color;
-void main()
-{
- gl_FragColor = v_color;
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512), title='Colored cube',
- keys='interactive')
-
- # Build cube data
- V, I, _ = create_cube()
- vertices = VertexBuffer(V)
- self.indices = IndexBuffer(I)
-
- # Build program
- self.program = Program(vertex, fragment)
- self.program.bind(vertices)
-
- # Build view, model, projection & normal
- view = translate((0, 0, -5))
- model = np.eye(4, dtype=np.float32)
- self.program['model'] = model
- self.program['view'] = view
- self.phi, self.theta = 0, 0
- gloo.set_state(clear_color=(0.30, 0.30, 0.35, 1.00), depth_test=True)
-
- self.activate_zoom()
-
- self.timer = app.Timer('auto', self.on_timer, start=True)
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
- self.program.draw('triangles', self.indices)
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- gloo.set_viewport(0, 0, *self.physical_size)
- projection = perspective(45.0, self.size[0] / float(self.size[1]),
- 2.0, 10.0)
- self.program['projection'] = projection
-
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- self.program['model'] = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.update()
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/tutorial/gloo/colored_quad.py b/examples/tutorial/gloo/colored_quad.py
deleted file mode 100644
index 13b1d50..0000000
--- a/examples/tutorial/gloo/colored_quad.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# -----------------------------------------------------------------------------
-
-from vispy import app, gloo
-from vispy.gloo import Program
-
-vertex = """
- attribute vec4 color;
- attribute vec2 position;
- varying vec4 v_color;
- void main()
- {
- gl_Position = vec4(position, 0.0, 1.0);
- v_color = color;
- } """
-
-fragment = """
- varying vec4 v_color;
- void main()
- {
- gl_FragColor = v_color;
- } """
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512), title='Colored quad',
- keys='interactive')
-
- # Build program & data
- self.program = Program(vertex, fragment, count=4)
- self.program['color'] = [(1, 0, 0, 1), (0, 1, 0, 1),
- (0, 0, 1, 1), (1, 1, 0, 1)]
- self.program['position'] = [(-1, -1), (-1, +1),
- (+1, -1), (+1, +1)]
-
- gloo.set_viewport(0, 0, *self.physical_size)
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear(color='white')
- self.program.draw('triangle_strip')
-
- def on_resize(self, event):
- gloo.set_viewport(0, 0, *event.physical_size)
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/tutorial/gloo/lighted_cube.py b/examples/tutorial/gloo/lighted_cube.py
deleted file mode 100644
index fbec790..0000000
--- a/examples/tutorial/gloo/lighted_cube.py
+++ /dev/null
@@ -1,157 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# -----------------------------------------------------------------------------
-
-import numpy as np
-
-from vispy import gloo, app
-from vispy.gloo import Program, VertexBuffer, IndexBuffer
-from vispy.util.transforms import perspective, translate, rotate
-from vispy.geometry import create_cube
-
-
-vertex = """
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform vec4 u_color;
-
-attribute vec3 position;
-attribute vec2 texcoord;
-attribute vec3 normal;
-attribute vec4 color;
-
-varying vec3 v_position;
-varying vec3 v_normal;
-varying vec4 v_color;
-
-void main()
-{
- v_normal = normal;
- v_position = position;
- v_color = color * u_color;
- gl_Position = u_projection * u_view * u_model * vec4(position,1.0);
-}
-"""
-
-fragment = """
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_normal;
-
-uniform vec3 u_light_intensity;
-uniform vec3 u_light_position;
-
-varying vec3 v_position;
-varying vec3 v_normal;
-varying vec4 v_color;
-
-void main()
-{
- // Calculate normal in world coordinates
- vec3 normal = normalize(u_normal * vec4(v_normal,1.0)).xyz;
-
- // Calculate the location of this fragment (pixel) in world coordinates
- vec3 position = vec3(u_view*u_model * vec4(v_position, 1));
-
- // Calculate the vector from this pixels surface to the light source
- vec3 surfaceToLight = u_light_position - position;
-
- // Calculate the cosine of the angle of incidence (brightness)
- float brightness = dot(normal, surfaceToLight) /
- (length(surfaceToLight) * length(normal));
- brightness = max(min(brightness,1.0),0.0);
-
- // Calculate final color of the pixel, based on:
- // 1. The angle of incidence: brightness
- // 2. The color/intensities of the light: light.intensities
- // 3. The texture and texture coord: texture(tex, fragTexCoord)
-
- gl_FragColor = v_color * brightness * vec4(u_light_intensity, 1);
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512), title='Lighted cube',
- keys='interactive')
- self.timer = app.Timer('auto', self.on_timer)
-
- # Build cube data
- V, F, O = create_cube()
- vertices = VertexBuffer(V)
- self.faces = IndexBuffer(F)
- self.outline = IndexBuffer(O)
-
- # Build view, model, projection & normal
- # --------------------------------------
- self.view = translate((0, 0, -5))
- model = np.eye(4, dtype=np.float32)
- normal = np.array(np.matrix(np.dot(self.view, model)).I.T)
-
- # Build program
- # --------------------------------------
- self.program = Program(vertex, fragment)
- self.program.bind(vertices)
- self.program["u_light_position"] = 2, 2, 2
- self.program["u_light_intensity"] = 1, 1, 1
- self.program["u_model"] = model
- self.program["u_view"] = self.view
- self.program["u_normal"] = normal
- self.phi, self.theta = 0, 0
-
- self.activate_zoom()
-
- # OpenGL initialization
- # --------------------------------------
- gloo.set_state(clear_color=(0.30, 0.30, 0.35, 1.00), depth_test=True,
- polygon_offset=(1, 1),
- blend_func=('src_alpha', 'one_minus_src_alpha'),
- line_width=0.75)
- self.timer.start()
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
- # program.draw(gl.GL_TRIANGLES, indices)
-
- # Filled cube
- gloo.set_state(blend=False, depth_test=True, polygon_offset_fill=True)
- self.program['u_color'] = 1, 1, 1, 1
- self.program.draw('triangles', self.faces)
-
- # Outlined cube
- gloo.set_state(polygon_offset_fill=False, blend=True, depth_mask=False)
- self.program['u_color'] = 0, 0, 0, 1
- self.program.draw('lines', self.outline)
- gloo.set_state(depth_mask=True)
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- gloo.set_viewport(0, 0, *self.physical_size)
- projection = perspective(45.0, self.size[0] / float(self.size[1]),
- 2.0, 10.0)
- self.program['u_projection'] = projection
-
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- model = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- normal = np.linalg.inv(np.dot(self.view, model)).T
- self.program['u_model'] = model
- self.program['u_normal'] = normal
- self.update()
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/tutorial/gloo/outlined_cube.py b/examples/tutorial/gloo/outlined_cube.py
deleted file mode 100644
index 941b179..0000000
--- a/examples/tutorial/gloo/outlined_cube.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# -----------------------------------------------------------------------------
-
-import numpy as np
-
-from vispy import gloo, app
-from vispy.gloo import Program, VertexBuffer, IndexBuffer
-from vispy.util.transforms import perspective, translate, rotate
-from vispy.geometry import create_cube
-
-vertex = """
-uniform mat4 u_model;
-uniform mat4 u_view;
-uniform mat4 u_projection;
-uniform vec4 u_color;
-
-attribute vec3 position;
-attribute vec2 texcoord;
-attribute vec3 normal;
-attribute vec4 color;
-
-varying vec4 v_color;
-void main()
-{
- v_color = u_color * color;
- gl_Position = u_projection * u_view * u_model * vec4(position,1.0);
-}
-"""
-
-fragment = """
-varying vec4 v_color;
-void main()
-{
- gl_FragColor = v_color;
-}
-"""
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512), title='Rotating cube',
- keys='interactive')
- self.timer = app.Timer('auto', self.on_timer)
-
- # Build cube data
- V, I, O = create_cube()
- vertices = VertexBuffer(V)
- self.faces = IndexBuffer(I)
- self.outline = IndexBuffer(O)
-
- # Build program
- # --------------------------------------
- self.program = Program(vertex, fragment)
- self.program.bind(vertices)
-
- # Build view, model, projection & normal
- # --------------------------------------
- view = translate((0, 0, -5))
- model = np.eye(4, dtype=np.float32)
-
- self.program['u_model'] = model
- self.program['u_view'] = view
- self.phi, self.theta = 0, 0
-
- self.activate_zoom()
-
- # OpenGL initialization
- # --------------------------------------
- gloo.set_state(clear_color=(0.30, 0.30, 0.35, 1.00), depth_test=True,
- polygon_offset=(1, 1), line_width=0.75,
- blend_func=('src_alpha', 'one_minus_src_alpha'))
- self.timer.start()
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
-
- # Filled cube
- gloo.set_state(blend=False, depth_test=True, polygon_offset_fill=True)
- self.program['u_color'] = 1, 1, 1, 1
- self.program.draw('triangles', self.faces)
-
- # Outlined cube
- gloo.set_state(blend=True, depth_mask=False, polygon_offset_fill=False)
- self.program['u_color'] = 0, 0, 0, 1
- self.program.draw('lines', self.outline)
- gloo.set_state(depth_mask=True)
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- gloo.set_viewport(0, 0, *self.physical_size)
- projection = perspective(45.0, self.size[0] / float(self.size[1]),
- 2.0, 10.0)
- self.program['u_projection'] = projection
-
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- self.program['u_model'] = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.update()
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/tutorial/gloo/rotating_quad.py b/examples/tutorial/gloo/rotating_quad.py
deleted file mode 100644
index ff60ea4..0000000
--- a/examples/tutorial/gloo/rotating_quad.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# -----------------------------------------------------------------------------
-
-from vispy import gloo, app
-from vispy.gloo import Program
-
-vertex = """
- uniform float theta;
- attribute vec4 color;
- attribute vec2 position;
- varying vec4 v_color;
- void main()
- {
- float ct = cos(theta);
- float st = sin(theta);
- float x = 0.75* (position.x*ct - position.y*st);
- float y = 0.75* (position.x*st + position.y*ct);
- gl_Position = vec4(x, y, 0.0, 1.0);
- v_color = color;
- } """
-
-fragment = """
- varying vec4 v_color;
- void main()
- {
- gl_FragColor = v_color;
- } """
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512), title='Rotating quad',
- keys='interactive')
- self.timer = app.Timer('auto', self.on_timer)
-
- # Build program & data
- self.program = Program(vertex, fragment, count=4)
- self.program['color'] = [(1, 0, 0, 1), (0, 1, 0, 1),
- (0, 0, 1, 1), (1, 1, 0, 1)]
- self.program['position'] = [(-1, -1), (-1, +1),
- (+1, -1), (+1, +1)]
- self.program['theta'] = 0.0
-
- gloo.set_viewport(0, 0, *self.physical_size)
-
- self.clock = 0
- self.timer.start()
-
- self.show()
-
- def on_draw(self, event):
- gloo.set_clear_color('white')
- gloo.clear(color=True)
- self.program.draw('triangle_strip')
-
- def on_resize(self, event):
- gloo.set_viewport(0, 0, *event.physical_size)
-
- def on_timer(self, event):
- self.clock += 0.001 * 1000.0 / 60.
- self.program['theta'] = self.clock
- self.update()
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/tutorial/gloo/texture_precision.py b/examples/tutorial/gloo/texture_precision.py
deleted file mode 100644
index 3de1b5d..0000000
--- a/examples/tutorial/gloo/texture_precision.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/env python
-
-# -----------------------------------------------------------------------------
-# Copyright 2015 University of Southern California.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Karl Czajkowski <karlcz at isi.edu>
-# Date: 2015-01-22
-# -----------------------------------------------------------------------------
-
-"""Example using texture internalformat for higher precision.
-
-Generates a gradient texture with high dynamic range and renders it
-with a fragment shader that tests for quantization errors by comparing
-adjacent texels and decomposes the gradient values into high and low
-significance bits, mapping them to separate display color channels.
-
-Pressing the 'f' key cycles through a list of different texture
-formats to show the different levels of precision available.
-"""
-
-import numpy as np
-from vispy import gloo
-from vispy import app
-
-W, H = 1024, 1024
-
-# prepare a gradient field with high dynamic range
-data = np.zeros((H, W, 3), np.float32)
-
-for i in range(W):
- data[:, i, :] = i**2
-
-for i in range(H):
- data[i, :, :] *= i**2
-
-data *= 1./data.max()
-
-# prepare a simple quad to cover the viewport
-quad = np.zeros(4, dtype=[
- ('a_position', np.float32, 2),
- ('a_texcoord', np.float32, 2)
-])
-
-quad['a_position'] = np.array([[-1, -1], [+1, -1], [-1, +1], [+1, +1]])
-quad['a_texcoord'] = np.array([[0, 0], [1, 0], [0, 1], [1, 1]])
-
-vert_shader = """
-attribute vec2 a_position;
-attribute vec2 a_texcoord;
-varying vec2 v_texcoord;
-
-void main()
-{
- v_texcoord = a_texcoord;
- gl_Position = vec4(a_position, 0.0, 1.0);
-}
-"""
-
-frag_shader = """
-uniform sampler2D u_texture;
-varying vec2 v_texcoord;
-
-void main()
-{
- float ndiff;
- // an adjacent texel is 1/W further over in normalized texture coordinates
- vec2 v_texcoord2 = vec2(clamp(v_texcoord.x + 1.0/%(W)d, 0.0, 1.0),
- v_texcoord.y);
- vec4 texel1 = texture2D(u_texture, v_texcoord);
- vec4 texel2 = texture2D(u_texture, v_texcoord2);
-
- // test for quantized binning of adjacent texels
- if (texel1.r == texel2.r && v_texcoord2.x < 1.0 && v_texcoord.y > 0.0)
- ndiff = 1.0;
- else
- ndiff = 0.0;
-
- gl_FragColor = vec4(
- fract(texel1.r * 255.0), // render low-significance bits as red
- texel1.r, // render high-significance bits as green
- ndiff, // flag quantized bands as blue
- 1);
-}
-""" % dict(W=W)
-
-
-class Canvas(app.Canvas):
-
- def __init__(self):
- app.Canvas.__init__(self, size=(W, H), keys='interactive')
-
- self._internalformats = [
- 'rgb8',
- 'rgb16',
- 'rgb16f',
- 'rgb32f'
- ]
-
- self.program = gloo.Program(vert_shader, frag_shader)
- self.program.bind(gloo.VertexBuffer(quad))
- self._internalformat = -1
- self.texture = gloo.Texture2D(
- shape=(H, W, 3),
- interpolation='nearest'
- )
-
- gloo.set_viewport(0, 0, *self.physical_size)
-
- self.toggle_internalformat()
-
- self.show()
-
- def on_key_press(self, event):
- if event.key == 'F':
- self.toggle_internalformat()
-
- def toggle_internalformat(self):
- self._internalformat = (
- (self._internalformat + 1)
- % len(self._internalformats)
- )
- internalformat = self._internalformats[self._internalformat]
- print("Requesting texture internalformat %s" % internalformat)
- self.texture.resize(
- data.shape,
- format='rgb',
- internalformat=internalformat
- )
- self.texture.set_data(data)
- self.program['u_texture'] = self.texture
- self.update()
-
- def on_resize(self, event):
- gloo.set_viewport(0, 0, *event.physical_size)
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
- self.program.draw('triangle_strip')
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/tutorial/gloo/textured_cube.py b/examples/tutorial/gloo/textured_cube.py
deleted file mode 100644
index edd3a64..0000000
--- a/examples/tutorial/gloo/textured_cube.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-# Author: Nicolas P .Rougier
-# Date: 04/03/2014
-# -----------------------------------------------------------------------------
-import numpy as np
-
-from vispy import gloo, app
-from vispy.gloo import Program, VertexBuffer, IndexBuffer
-from vispy.util.transforms import perspective, translate, rotate
-from vispy.geometry import create_cube
-
-
-vertex = """
-uniform mat4 model;
-uniform mat4 view;
-uniform mat4 projection;
-uniform sampler2D texture;
-
-attribute vec3 position;
-attribute vec2 texcoord;
-attribute vec3 normal;
-attribute vec4 color;
-
-varying vec2 v_texcoord;
-void main()
-{
- gl_Position = projection * view * model * vec4(position,1.0);
- v_texcoord = texcoord;
-}
-"""
-
-fragment = """
-uniform sampler2D texture;
-varying vec2 v_texcoord;
-void main()
-{
- gl_FragColor = texture2D(texture, v_texcoord);
-}
-"""
-
-
-def checkerboard(grid_num=8, grid_size=32):
- row_even = grid_num // 2 * [0, 1]
- row_odd = grid_num // 2 * [1, 0]
- Z = np.row_stack(grid_num // 2 * (row_even, row_odd)).astype(np.uint8)
- return 255 * Z.repeat(grid_size, axis=0).repeat(grid_size, axis=1)
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512), title='Textured cube',
- keys='interactive')
- self.timer = app.Timer('auto', self.on_timer)
-
- # Build cube data
- V, I, _ = create_cube()
- vertices = VertexBuffer(V)
- self.indices = IndexBuffer(I)
-
- # Build program
- self.program = Program(vertex, fragment)
- self.program.bind(vertices)
-
- # Build view, model, projection & normal
- view = translate((0, 0, -5))
- model = np.eye(4, dtype=np.float32)
- self.program['model'] = model
- self.program['view'] = view
- self.program['texture'] = checkerboard()
-
- self.activate_zoom()
-
- self.phi, self.theta = 0, 0
-
- # OpenGL initalization
- gloo.set_state(clear_color=(0.30, 0.30, 0.35, 1.00), depth_test=True)
- self.timer.start()
-
- self.show()
-
- def on_draw(self, event):
- gloo.clear(color=True, depth=True)
- self.program.draw('triangles', self.indices)
-
- def on_resize(self, event):
- self.activate_zoom()
-
- def activate_zoom(self):
- gloo.set_viewport(0, 0, *self.physical_size)
- projection = perspective(45.0, self.size[0] / float(self.size[1]),
- 2.0, 10.0)
- self.program['projection'] = projection
-
- def on_timer(self, event):
- self.theta += .5
- self.phi += .5
- self.program['model'] = np.dot(rotate(self.theta, (0, 0, 1)),
- rotate(self.phi, (0, 1, 0)))
- self.update()
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/tutorial/gloo/textured_quad.py b/examples/tutorial/gloo/textured_quad.py
deleted file mode 100644
index 42432ac..0000000
--- a/examples/tutorial/gloo/textured_quad.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2014, Nicolas P. Rougier. All rights reserved.
-# Distributed under the terms of the new BSD License.
-# -----------------------------------------------------------------------------
-
-import numpy as np
-
-from vispy import gloo, app
-from vispy.gloo import Program
-
-vertex = """
- attribute vec2 position;
- attribute vec2 texcoord;
- varying vec2 v_texcoord;
- void main()
- {
- gl_Position = vec4(position, 0.0, 1.0);
- v_texcoord = texcoord;
- } """
-
-fragment = """
- uniform sampler2D texture;
- varying vec2 v_texcoord;
- void main()
- {
- gl_FragColor = texture2D(texture, v_texcoord);
- } """
-
-
-def checkerboard(grid_num=8, grid_size=32):
- row_even = grid_num // 2 * [0, 1]
- row_odd = grid_num // 2 * [1, 0]
- Z = np.row_stack(grid_num // 2 * (row_even, row_odd)).astype(np.uint8)
- return 255 * Z.repeat(grid_size, axis=0).repeat(grid_size, axis=1)
-
-
-class Canvas(app.Canvas):
- def __init__(self):
- app.Canvas.__init__(self, size=(512, 512), title='Textured quad',
- keys='interactive')
-
- # Build program & data
- self.program = Program(vertex, fragment, count=4)
- self.program['position'] = [(-1, -1), (-1, +1),
- (+1, -1), (+1, +1)]
- self.program['texcoord'] = [(0, 0), (1, 0), (0, 1), (1, 1)]
- self.program['texture'] = checkerboard()
-
- gloo.set_viewport(0, 0, *self.physical_size)
-
- self.show()
-
- def on_draw(self, event):
- gloo.set_clear_color('white')
- gloo.clear(color=True)
- self.program.draw('triangle_strip')
-
- def on_resize(self, event):
- gloo.set_viewport(0, 0, *event.physical_size)
-
-if __name__ == '__main__':
- c = Canvas()
- app.run()
diff --git a/examples/tutorial/visuals/T01_basic_visual.py b/examples/tutorial/visuals/T01_basic_visual.py
deleted file mode 100644
index 1401237..0000000
--- a/examples/tutorial/visuals/T01_basic_visual.py
+++ /dev/null
@@ -1,167 +0,0 @@
-"""
-Tutorial: Creating Visuals
---------------------------
-
-This tutorial is intended to guide developers who are interested in creating
-new subclasses of Visual. In most cases, this will not be necessary because
-vispy's base library of visuals will be sufficient to create complex scenes as
-needed. However, there are cases where a particular visual effect is desired
-that is not supported in the base library, or when a custom visual is needed to
-optimize performance for a specific use case.
-
-The purpose of a Visual is to encapsulate a single drawable object. This
-drawable can be as simple or complex as desired. Some of the simplest visuals
-draw points, lines, or triangles, whereas more complex visuals invove multiple
-drawing stages or make use of sub-visuals to construct larger objects.
-
-In this example we will create a very simple Visual that draws a rectangle.
-Visuals are defined by:
-
-1. Creating a subclass of vispy.visuals.Visual
-2. Defining a draw() method that takes into account some user-specified
- transformation functions.
-
-
-"""
-from vispy import app, gloo, visuals, scene
-import numpy as np
-
-# Define a simple vertex shader. We use $template variables as placeholders for
-# code that will be inserted later on. In this example, $position will become
-# an attribute, and $transform will become a function. Important: using
-# $transform in this way ensures that users of this visual will be able to
-# apply arbitrary transformations to it.
-vertex_shader = """
-void main() {
- gl_Position = $transform(vec4($position, 0, 1));
-}
-"""
-
-# Very simple fragment shader. Again we use a template variable "$color", which
-# allows us to decide later how the color should be defined (in this case, we
-# will just use a uniform red color).
-fragment_shader = """
-void main() {
- gl_FragColor = $color;
-}
-"""
-
-
-# Start the new Visual class.
-# By convention, all Visual subclass names end in 'Visual'.
-# (Custom visuals may ignore this convention, but for visuals that are built
-# in to vispy, this is required to ensure that the VisualNode subclasses are
-# generated correctly.)
-class MyRectVisual(visuals.Visual):
- """Visual that draws a red rectangle.
-
- Parameters
- ----------
- x : float
- x coordinate of rectangle origin
- y : float
- y coordinate of rectangle origin
- w : float
- width of rectangle
- h : float
- height of rectangle
-
- All parameters are specified in the local (arbitrary) coordinate system of
- the visual. How this coordinate system translates to the canvas will
- depend on the transformation functions used during drawing.
- """
-
- # There are no constraints on the signature of the __init__ method; use
- # whatever makes the most sense for your visual.
- def __init__(self, x, y, w, h):
- visuals.Visual.__init__(self)
-
- # vertices for two triangles forming a rectangle
- self.vbo = gloo.VertexBuffer(np.array([
- [x, y], [x+w, y], [x+w, y+h],
- [x, y], [x+w, y+h], [x, y+h]
- ], dtype=np.float32))
-
- # We use a ModularProgram because it allows us to plug in arbitrary
- # transformation functions. This is recommended but not strictly
- # required.
- self.program = visuals.shaders.ModularProgram(vertex_shader,
- fragment_shader)
-
- # Assign values to the $position and $color template variables in
- # the shaders. ModularProgram automatically handles generating the
- # necessary attribute and uniform declarations with unique variable
- # names.
- self.program.vert['position'] = self.vbo
- self.program.frag['color'] = (1, 0, 0, 1)
-
- # The draw method is required to take a single argument that will be an
- # instance of visuals.transforms.TransformSystem.
- def draw(self, transforms):
- # The TransformSystem provides information about:
- #
- # * The transformation requested by the user (usually translation,
- # rotation, and scaling)
- # * The canvas dpi and the size of logical pixels
- # * The relationship between physical pixels and logical pixels, which
- # is important for some high-resolution displays and when exporting
- # to images
-
- # For the simple case of this visual, all we need to know is how to
- # convert from the user-specified coordinates (x, y, w, h) to the
- # normalized device coordinates required by the vertex shader. We will
- # explore other uses of the TransformSystem in later tutorials.
- self.program.vert['transform'] = transforms.get_full_transform()
-
- # Finally, draw the triangles.
- self.program.draw('triangles')
-
-
-# At this point the visual is ready to use, but it takes some extra effort to
-# set up a Canvas and TransformSystem for drawing (the examples in
-# examples/basics/visuals/ all follow this approach).
-#
-# An easier approach is to make the visual usable in a scenegraph, in which
-# case the canvas will take care of drawing the visual and setting up the
-# TransformSystem for us.
-#
-# To be able to use our new Visual in a scenegraph, it needs to be
-# a subclass of scene.Node. In vispy we achieve this by creating a parallel
-# set of classes that inherit from both Node and each Visual subclass.
-# This can be done automatically using scene.visuals.create_visual_node():
-MyRect = scene.visuals.create_visual_node(MyRectVisual)
-
-# By convention, these classes have the same name as the Visual they inherit
-# from, but without the 'Visual' suffix.
-
-# The auto-generated class MyRect is basically equivalent to::
-#
-# class MyRect(MyRectVisual, scene.Node):
-# def __init__(self, *args, **kwds):
-# parent = kwds.pop('parent', None)
-# name = kwds.pop('name', None)
-# MyRectVisual.__init__(self, *args, **kwds)
-# Node.__init__(self, parent=parent, name=name)
-#
-
-
-# Finally we will test the visual by displaying in a scene.
-
-# Create a canvas to display our visual
-canvas = scene.SceneCanvas(keys='interactive', show=True)
-
-# Create two instances of MyRect, each using canvas.scene as their parent
-rects = [MyRect(100, 100, 200, 300, parent=canvas.scene),
- MyRect(500, 100, 200, 300, parent=canvas.scene)]
-
-# To test that the user-specified transforms work correctly, I'll rotate
-# one rectangle slightly.
-tr = visuals.transforms.AffineTransform()
-tr.rotate(5, (0, 0, 1))
-rects[1].transform = tr
-
-# ..and optionally start the event loop
-if __name__ == '__main__':
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/tutorial/visuals/T02_measurements.py b/examples/tutorial/visuals/T02_measurements.py
deleted file mode 100644
index 5ab3a34..0000000
--- a/examples/tutorial/visuals/T02_measurements.py
+++ /dev/null
@@ -1,227 +0,0 @@
-"""
-Tutorial: Creating Visuals
-==========================
-
-02. Making physical measurements
---------------------------------
-
-In the last tutorial we created a simple Visual subclass that draws a
-rectangle. In this tutorial, we will make two additions:
-
- 1. Draw a rectangular border instead of a solid rectangle
- 2. Make the border a fixed pixel width, even when displayed inside a
- user-zoomable ViewBox.
-
-The border is made by drawing a line_strip with 10 vertices::
-
- 1--------------3
- | |
- | 2------4 | [ note that points 9 and 10 are
- | | | | the same as points 1 and 2 ]
- | 8------6 |
- | |
- 7--------------5
-
-In order to ensure that the border has a fixed width in pixels, we need to
-adjust the spacing between the inner and outer rectangles whenever the user
-changes the zoom of the ViewBox.
-
-How? Recall that each
-time the visual is drawn, it is given a TransformSystem instance that carries
-information about the size of logical and physical pixels relative to the
-visual [link to TransformSystem documentation]. Essentially, we have 4
-coordinate systems:
-
- Visual -> Document -> Framebuffer -> Render
-
-The user specifies the position and size of the rectangle in Visual
-coordinates, and in [tutorial 1] we used the vertex shader to convert directly
-from Visual coordinates to render coordinates. In this tutorial we will
-convert first to document coordinates, then make the adjustment for the border
-width, then convert the remainder of the way to render coordinates.
-
-Let's say, for example that the user specifies the box width to be 20, and the
-border width to be 5. To draw the border correctly, we cannot simply
-add/subtract 5 from the inner rectangle coordinates; if the user zooms
-in by a factor of 2 then the border would become 10 px wide.
-
-Another way to say this is that a vector with length=1 in Visual coordinates
-does not _necessarily_ have a length of 1 pixel on the canvas. Instead, we must
-make use of the Document coordinate system, in which a vector of length=1
-does correspond to 1 pixel.
-
-There are a few ways we could make this measurement of pixel length. Here's
-how we'll do it in this tutorial:
-
- 1. Begin with vertices for a rectangle with border width 0 (that is, vertex
- 1 is the same as vertex 2, 3=4, and so on).
- 2. In the vertex shader, first map the vertices to the document coordinate
- system using the visual->document transform.
- 3. Add/subtract the line width from the mapped vertices.
- 4. Map the rest of the way to render coordinates with a second transform:
- document->framebuffer->render.
-
-Note that this problem _cannot_ be solved using a simple scale factor! It is
-necessary to use these transformations in order to draw correctly when there
-is rotation or anosotropic scaling involved.
-
-"""
-from vispy import app, gloo, visuals, scene
-import numpy as np
-
-
-vertex_shader = """
-void main() {
- // First map the vertex to document coordinates
- vec4 doc_pos = $visual_to_doc(vec4($position, 0, 1));
-
- // Also need to map the adjustment direction vector, but this is tricky!
- // We need to adjust separately for each component of the vector:
- vec4 adjusted;
- if ( $adjust_dir.x == 0 ) {
- // If this is an outer vertex, no adjustment for line weight is needed.
- // (In fact, trying to make the adjustment would result in no
- // triangles being drawn, hence the if/else block)
- adjusted = doc_pos;
- }
- else {
- // Inner vertexes must be adjusted for line width, but this is
- // surprisingly tricky given that the rectangle may have been scaled
- // and rotated!
- vec4 doc_x = $visual_to_doc(vec4($adjust_dir.x, 0, 0, 0)) -
- $visual_to_doc(vec4(0, 0, 0, 0));
- vec4 doc_y = $visual_to_doc(vec4(0, $adjust_dir.y, 0, 0)) -
- $visual_to_doc(vec4(0, 0, 0, 0));
- doc_x = normalize(doc_x);
- doc_y = normalize(doc_y);
-
- // Now doc_x + doc_y points in the direction we need in order to
- // correct the line weight of _both_ segments, but the magnitude of
- // that correction is wrong. To correct it we first need to
- // measure the width that would result from using doc_x + doc_y:
- vec4 proj_y_x = dot(doc_x, doc_y) * doc_x; // project y onto x
- float cur_width = length(doc_y - proj_y_x); // measure current weight
-
- // And now we can adjust vertex position for line width:
- adjusted = doc_pos + ($line_width / cur_width) * (doc_x + doc_y);
- }
-
- // Finally map the remainder of the way to render coordinates
- gl_Position = $doc_to_render(adjusted);
-}
-"""
-
-fragment_shader = """
-void main() {
- gl_FragColor = $color;
-}
-"""
-
-
-class MyRectVisual(visuals.Visual):
- """Visual that draws a rectangular outline.
-
- Parameters
- ----------
- x : float
- x coordinate of rectangle origin
- y : float
- y coordinate of rectangle origin
- w : float
- width of rectangle
- h : float
- height of rectangle
- weight : float
- width of border (in px)
- """
-
- def __init__(self, x, y, w, h, weight=4.0):
- visuals.Visual.__init__(self)
-
- # 10 vertices for 8 triangles (using triangle_strip) forming a
- # rectangular outline
- self.vert_buffer = gloo.VertexBuffer(np.array([
- [x, y],
- [x, y],
- [x+w, y],
- [x+w, y],
- [x+w, y+h],
- [x+w, y+h],
- [x, y+h],
- [x, y+h],
- [x, y],
- [x, y],
- ], dtype=np.float32))
-
- # Direction each vertex should move to correct for line width
- # (the length of this vector will be corrected in the shader)
- self.adj_buffer = gloo.VertexBuffer(np.array([
- [0, 0],
- [1, 1],
- [0, 0],
- [-1, 1],
- [0, 0],
- [-1, -1],
- [0, 0],
- [1, -1],
- [0, 0],
- [1, 1],
- ], dtype=np.float32))
-
- self.program = visuals.shaders.ModularProgram(vertex_shader,
- fragment_shader)
-
- self.program.vert['position'] = self.vert_buffer
- self.program.vert['adjust_dir'] = self.adj_buffer
- self.program.vert['line_width'] = weight
- self.program.frag['color'] = (1, 0, 0, 1)
-
- def draw(self, transforms):
- gloo.set_state(cull_face=False)
-
- # Set the two transforms required by the vertex shader:
- self.program.vert['visual_to_doc'] = transforms.visual_to_document
- self.program.vert['doc_to_render'] = (
- transforms.framebuffer_to_render *
- transforms.document_to_framebuffer)
-
- # Finally, draw the triangles.
- self.program.draw('triangle_strip')
-
-
-# As in the previous tutorial, we auto-generate a Visual+Node class for use
-# in the scenegraph.
-MyRect = scene.visuals.create_visual_node(MyRectVisual)
-
-
-# Finally we will test the visual by displaying in a scene.
-
-canvas = scene.SceneCanvas(keys='interactive', show=True)
-
-# This time we add a ViewBox to let the user zoom/pan
-view = canvas.central_widget.add_view()
-view.camera = 'panzoom'
-view.camera.rect = (0, 0, 800, 800)
-
-# ..and add the rects to the view instead of canvas.scene
-rects = [MyRect(100, 100, 200, 300, parent=view.scene),
- MyRect(500, 100, 200, 300, parent=view.scene)]
-
-# Again, rotate one rectangle to ensure the transforms are working as we
-# expect.
-tr = visuals.transforms.AffineTransform()
-tr.rotate(25, (0, 0, 1))
-rects[1].transform = tr
-
-# Add some text instructions
-text = scene.visuals.Text("Drag right mouse button to zoom.",
- color='w',
- anchor_x='left',
- parent=view,
- pos=(20, 30))
-
-# ..and optionally start the event loop
-if __name__ == '__main__':
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/tutorial/visuals/T03_antialiasing.py b/examples/tutorial/visuals/T03_antialiasing.py
deleted file mode 100644
index 2a7872f..0000000
--- a/examples/tutorial/visuals/T03_antialiasing.py
+++ /dev/null
@@ -1,216 +0,0 @@
-"""
-Tutorial: Creating Visuals
-==========================
-
-03. Antialiasing
-----------------
-
-In [tutorial 1] we learned how to draw a simple rectangle, and in [tutorial 2]
-we expanded on this by using the Document coordinate system to draw a
-rectangular border of a specific width. In this tutorial we introduce the
-Framebuffer coordinate system, which is used for antialiasing measurements.
-
-In order to antialias our edges, we need to introduce a calculation to the
-fragment shader that computes, for each pixel being drawn, the fraction of the
-pixel that is covered by the visual's geometry. At first glance, it may seem
-that the Document coordinate system is sufficient for this purpose because it
-has unit-length pixels. However, there are two situations when the actual
-pixels being filled by the fragment shader are not the same size as the pixels
-on the canvas:
-
- 1. High-resolution displays (such as retina displays) that report a canvas
- resolution smaller than the actual framebuffer resolution.
- 2. When exporting to an image with a different size than the canvas.
-
-In most cases the discrepancy between Document and Framebuffer coordinates can
-be corrected by a simple scale factor. However, this fails for some interesting
-corner cases where the transform is more complex, such as in VR applications
-using optical distortion correction. Decide for yourself: is this Visual for
-my personal use, or is it intended for a broader audience? For simplicity in
-this example, we will use a simple scale factor.
-"""
-
-from vispy import app, gloo, visuals, scene
-import numpy as np
-
-
-# Here we use almost the same vertex shader as in tutorial 2.
-# The important difference is the addition of the line_pos variable,
-# which measures position across the width of the border line.
-vertex_shader = """
-varying float line_pos; // how far we are across the border line
-
-void main() {
- // First map the vertex to document coordinates
- vec4 doc_pos = $visual_to_doc(vec4($position, 0, 1));
-
- vec4 adjusted;
- if ( $adjust_dir.x == 0 ) {
- adjusted = doc_pos;
- line_pos = $line_width; // at the outside of the border
- }
- else {
- // Inner vertexes must be adjusted for line width
- vec4 doc_x = $visual_to_doc(vec4($adjust_dir.x, 0, 0, 0)) -
- $visual_to_doc(vec4(0, 0, 0, 0));
- vec4 doc_y = $visual_to_doc(vec4(0, $adjust_dir.y, 0, 0)) -
- $visual_to_doc(vec4(0, 0, 0, 0));
- doc_x = normalize(doc_x);
- doc_y = normalize(doc_y);
-
- vec4 proj_y_x = dot(doc_x, doc_y) * doc_x; // project y onto x
- float cur_width = length(doc_y - proj_y_x); // measure current weight
-
- // And now we can adjust vertex position for line width:
- adjusted = doc_pos + ($line_width / cur_width) * (doc_x + doc_y);
-
- line_pos = 0; // at the inside of the border
- }
-
- // Finally map the remainder of the way to render coordinates
- gl_Position = $doc_to_render(adjusted);
-}
-"""
-
-# The fragment shader is updated to change the opacity of the color based on
-# the amount of the fragment that is covered by the visual's geometry.
-fragment_shader = """
-varying float line_pos;
-
-void main() {
- // Decrease the alpha linearly as we come within 1 pixel of the edge.
- // Note: this only approximates the actual fraction of the pixel that is
- // covered by the visual's geometry. A more accurate measurement would
- // produce better antialiasing, but the effect would be subtle.
- float alpha = 1.0;
- if ((line_pos * $doc_fb_scale) < 1) {
- alpha = $color.a * line_pos;
- }
- else if ((line_pos * $doc_fb_scale) > ($line_width - 1)) {
- alpha = $color.a * ($line_width - line_pos);
- }
- gl_FragColor = vec4($color.rgb, alpha);
-}
-"""
-
-
-# The visual class is defined almost exactly as in [tutorial 2]. The only
-# major difference is that the draw() method now calculates a scale factor
-# for converting between document and framebuffer coordinates.
-class MyRectVisual(visuals.Visual):
- """Visual that draws a rectangular outline.
-
- Parameters
- ----------
- x : float
- x coordinate of rectangle origin
- y : float
- y coordinate of rectangle origin
- w : float
- width of rectangle
- h : float
- height of rectangle
- weight : float
- width of border (in px)
- """
-
- def __init__(self, x, y, w, h, weight=4.0):
- visuals.Visual.__init__(self)
- self.weight = weight
-
- # 10 vertices for 8 triangles (using triangle_strip) forming a
- # rectangular outline
- self.vert_buffer = gloo.VertexBuffer(np.array([
- [x, y],
- [x, y],
- [x+w, y],
- [x+w, y],
- [x+w, y+h],
- [x+w, y+h],
- [x, y+h],
- [x, y+h],
- [x, y],
- [x, y],
- ], dtype=np.float32))
-
- # Direction each vertex should move to correct for line width
- # (the length of this vector will be corrected in the shader)
- self.adj_buffer = gloo.VertexBuffer(np.array([
- [0, 0],
- [1, 1],
- [0, 0],
- [-1, 1],
- [0, 0],
- [-1, -1],
- [0, 0],
- [1, -1],
- [0, 0],
- [1, 1],
- ], dtype=np.float32))
-
- self.program = visuals.shaders.ModularProgram(vertex_shader,
- fragment_shader)
-
- self.program.vert['position'] = self.vert_buffer
- self.program.vert['adjust_dir'] = self.adj_buffer
- # To compensate for antialiasing, add 1 to border width:
- self.program.vert['line_width'] = weight + 1
- self.program.frag['color'] = (1, 0, 0, 1)
-
- def draw(self, transforms):
- gloo.set_state(cull_face=False)
-
- # Set the two transforms required by the vertex shader:
- self.program.vert['visual_to_doc'] = transforms.visual_to_document
- self.program.vert['doc_to_render'] = (
- transforms.framebuffer_to_render *
- transforms.document_to_framebuffer)
-
- # Set the scale factor between document and framebuffer coordinate
- # systems. This assumes a simple linear / isotropic scale; more complex
- # transforms will yield strange results!
- fbs = np.linalg.norm(transforms.document_to_framebuffer.map([1, 0]) -
- transforms.document_to_framebuffer.map([0, 0]))
- self.program.frag['doc_fb_scale'] = fbs
- self.program.frag['line_width'] = (self.weight + 1) * fbs
-
- # Finally, draw the triangles.
- self.program.draw('triangle_strip')
-
-
-# As in the previous tutorial, we auto-generate a Visual+Node class for use
-# in the scenegraph.
-MyRect = scene.visuals.create_visual_node(MyRectVisual)
-
-
-# Finally we will test the visual by displaying in a scene.
-
-canvas = scene.SceneCanvas(keys='interactive', show=True)
-
-# This time we add a ViewBox to let the user zoom/pan
-view = canvas.central_widget.add_view()
-view.camera = 'panzoom'
-view.camera.rect = (0, 0, 800, 800)
-
-# ..and add the rects to the view instead of canvas.scene
-rects = [MyRect(100, 100, 200, 300, parent=view.scene),
- MyRect(500, 100, 200, 300, parent=view.scene)]
-
-# Again, rotate one rectangle to ensure the transforms are working as we
-# expect.
-tr = visuals.transforms.AffineTransform()
-tr.rotate(25, (0, 0, 1))
-rects[1].transform = tr
-
-# Add some text instructions
-text = scene.visuals.Text("Drag right mouse button to zoom.",
- color='w',
- anchor_x='left',
- parent=view,
- pos=(20, 30))
-
-# ..and optionally start the event loop
-if __name__ == '__main__':
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/tutorial/visuals/T04_fragment_programs.py b/examples/tutorial/visuals/T04_fragment_programs.py
deleted file mode 100644
index a07278f..0000000
--- a/examples/tutorial/visuals/T04_fragment_programs.py
+++ /dev/null
@@ -1,81 +0,0 @@
-"""
-Tutorial: Creating Visuals
-==========================
-
-04. Fragment Programs
----------------------
-
-In this tutorial, we will demonstrate the use of the fragment shader as a
-raycaster to draw complex shapes on a simple rectanglular mesh.
-
-Previous tutorials focused on the use of forward transformation functions to
-map vertices from the local coordinate system of the visual to the "render
-coordinates" output of the vertex shader. In this tutorial, we will use inverse
-transformation functions in the fragment shader to map backward from the
-current fragment location to the visual's local coordinate system.
-"""
-import numpy as np
-from vispy import app, gloo, visuals, scene
-
-
-vertex_shader = """
-void main() {
- gl_Position = vec4($position, 0, 1);
-}
-"""
-
-fragment_shader = """
-void main() {
- vec4 pos = $fb_to_visual(gl_FragCoord);
- gl_FragColor = vec4(sin(pos.x / 10.), sin(pos.y / 10.), 0, 1);
-}
-"""
-
-
-class MyRectVisual(visuals.Visual):
- """
- """
-
- def __init__(self):
- visuals.Visual.__init__(self)
- self.vbo = gloo.VertexBuffer(np.array([
- [-1, -1], [1, -1], [1, 1],
- [-1, -1], [1, 1], [-1, 1]
- ], dtype=np.float32))
- self.program = visuals.shaders.ModularProgram(vertex_shader,
- fragment_shader)
- self.program.vert['position'] = self.vbo
-
- def draw(self, transforms):
- gloo.set_state(cull_face=False)
-
- tr = (transforms.visual_to_document *
- transforms.document_to_framebuffer).inverse
- self.program.frag['fb_to_visual'] = tr
-
- # Finally, draw the triangles.
- self.program.draw('triangle_fan')
-
-
-# As in the previous tutorial, we auto-generate a Visual+Node class for use
-# in the scenegraph.
-MyRect = scene.visuals.create_visual_node(MyRectVisual)
-
-
-# Finally we will test the visual by displaying in a scene.
-
-canvas = scene.SceneCanvas(keys='interactive', show=True)
-
-# This time we add a ViewBox to let the user zoom/pan
-view = canvas.central_widget.add_view()
-view.camera = 'panzoom'
-view.camera.rect = (0, 0, 800, 800)
-
-vis = MyRect()
-view.add(vis)
-
-# ..and optionally start the event loop
-if __name__ == '__main__':
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/examples/tutorial/visuals/T05_viewer_location.py b/examples/tutorial/visuals/T05_viewer_location.py
deleted file mode 100644
index 4eab51e..0000000
--- a/examples/tutorial/visuals/T05_viewer_location.py
+++ /dev/null
@@ -1,97 +0,0 @@
-"""
-Tutorial: Creating Visuals
-==========================
-
-05. Camera location
--------------------
-
-In this tutorial we will demonstrate how to determine the direction from which
-a Visual is being viewed.
-"""
-
-from vispy import app, gloo, visuals, scene, io
-
-
-vertex_shader = """
-varying vec4 color;
-void main() {
- vec4 visual_pos = vec4($position, 1);
- vec4 doc_pos = $visual_to_doc(visual_pos);
- gl_Position = $doc_to_render(doc_pos);
-
- vec4 visual_pos2 = $doc_to_visual(doc_pos + vec4(0, 0, -1, 0));
- vec4 view_direction = (visual_pos2 / visual_pos2.w) - visual_pos;
- view_direction = vec4(normalize(view_direction.xyz), 0);
-
- color = vec4(view_direction.rgb, 1);
-}
-"""
-
-fragment_shader = """
-varying vec4 color;
-void main() {
- gl_FragColor = color;
-}
-"""
-
-
-class MyMeshVisual(visuals.Visual):
- """
- """
-
- def __init__(self):
- visuals.Visual.__init__(self)
-
- # Create an interesting mesh shape for demonstration.
- fname = io.load_data_file('orig/triceratops.obj.gz')
- vertices, faces, normals, tex = io.read_mesh(fname)
-
- self._ibo = gloo.IndexBuffer(faces)
-
- self.program = visuals.shaders.ModularProgram(vertex_shader,
- fragment_shader)
- self.program.vert['position'] = gloo.VertexBuffer(vertices)
- #self.program.vert['normal'] = gloo.VertexBuffer(normals)
-
- def draw(self, transforms):
- # Note we use the "additive" GL blending settings so that we do not
- # have to sort the mesh triangles back-to-front before each draw.
- gloo.set_state('additive', cull_face=False)
-
- self.program.vert['visual_to_doc'] = transforms.visual_to_document
- imap = transforms.visual_to_document.inverse
- self.program.vert['doc_to_visual'] = imap
- self.program.vert['doc_to_render'] = (
- transforms.framebuffer_to_render *
- transforms.document_to_framebuffer)
-
- # Finally, draw the triangles.
- self.program.draw('triangles', self._ibo)
-
-
-# Auto-generate a Visual+Node class for use in the scenegraph.
-MyMesh = scene.visuals.create_visual_node(MyMeshVisual)
-
-
-# Finally we will test the visual by displaying in a scene.
-
-canvas = scene.SceneCanvas(keys='interactive', show=True)
-
-# Add a ViewBox to let the user zoom/rotate
-view = canvas.central_widget.add_view()
-view.camera = 'turntable'
-view.camera.fov = 50
-view.camera.distance = 2
-
-mesh = MyMesh(parent=view.scene)
-mesh.transform = visuals.transforms.AffineTransform()
-#mesh.transform.translate([-25, -25, -25])
-mesh.transform.rotate(90, (1, 0, 0))
-
-axis = scene.visuals.XYZAxis(parent=view.scene)
-
-# ..and optionally start the event loop
-if __name__ == '__main__':
- import sys
- if sys.flags.interactive != 1:
- app.run()
diff --git a/make/__init__.py b/make/__init__.py
deleted file mode 100644
index 41c1a9d..0000000
--- a/make/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-"""
-By putting make.py in a package, we can do "python make" instead of
-"python make.py".
-"""
-from __future__ import print_function, division
-from .make import Maker # noqa
diff --git a/make/__main__.py b/make/__main__.py
deleted file mode 100644
index bd08f27..0000000
--- a/make/__main__.py
+++ /dev/null
@@ -1,13 +0,0 @@
-
-from __future__ import print_function, division
-
-import os
-import sys
-from make import Maker
-
-START_DIR = os.path.abspath(os.getcwd())
-
-try:
- Maker(sys.argv)
-finally:
- os.chdir(START_DIR)
diff --git a/make/install_python.ps1 b/make/install_python.ps1
deleted file mode 100644
index f18a107..0000000
--- a/make/install_python.ps1
+++ /dev/null
@@ -1,125 +0,0 @@
-# Sample script to install Python and pip under Windows
-# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner
-# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
-
-$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
-$MESA_GL_URL = "https://github.com/vispy/demo-data/raw/master/mesa/"
-
-# Mesa DLLs found linked from:
-# http://qt-project.org/wiki/Cross-compiling-Mesa-for-Windows
-# to:
-# http://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/mingw-w64-x86_64-mesa-10.2.4-1-any.pkg.tar.xz/download
-
-function DownloadMesaOpenGL ($architecture) {
- $webclient = New-Object System.Net.WebClient
- $basedir = $pwd.Path + "\"
- $filepath = $basedir + "opengl32.dll"
- # Download and retry up to 3 times in case of network transient errors.
- $url = $MESA_GL_URL + "opengl32_mingw_" + $architecture + ".dll"
- Write-Host "Downloading" $url
- $retry_attempts = 2
- for($i=0; $i -lt $retry_attempts; $i++){
- try {
- $webclient.DownloadFile($url, $filepath)
- break
- }
- Catch [Exception]{
- Start-Sleep 1
- }
- }
- if (Test-Path $filepath) {
- Write-Host "File saved at" $filepath
- } else {
- # Retry once to get the error message if any at the last try
- $webclient.DownloadFile($url, $filepath)
- }
-}
-
-
-function DownloadMiniconda ($python_version, $platform_suffix) {
- $webclient = New-Object System.Net.WebClient
- if ($python_version -eq "3.4") {
- $filename = "Miniconda3-3.7.0-Windows-" + $platform_suffix + ".exe"
- } else {
- $filename = "Miniconda-3.7.0-Windows-" + $platform_suffix + ".exe"
- }
- $url = $MINICONDA_URL + $filename
-
- $basedir = $pwd.Path + "\"
- $filepath = $basedir + $filename
- if (Test-Path $filename) {
- Write-Host "Reusing" $filepath
- return $filepath
- }
-
- # Download and retry up to 3 times in case of network transient errors.
- Write-Host "Downloading" $filename "from" $url
- $retry_attempts = 2
- for($i=0; $i -lt $retry_attempts; $i++){
- try {
- $webclient.DownloadFile($url, $filepath)
- break
- }
- Catch [Exception]{
- Start-Sleep 1
- }
- }
- if (Test-Path $filepath) {
- Write-Host "File saved at" $filepath
- } else {
- # Retry once to get the error message if any at the last try
- $webclient.DownloadFile($url, $filepath)
- }
- return $filepath
-}
-
-
-function InstallMiniconda ($python_version, $architecture, $python_home) {
- Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
- if (Test-Path $python_home) {
- Write-Host $python_home "already exists, skipping."
- return $false
- }
- if ($architecture -eq "32") {
- $platform_suffix = "x86"
- } else {
- $platform_suffix = "x86_64"
- }
- $filepath = DownloadMiniconda $python_version $platform_suffix
- Write-Host "Installing" $filepath "to" $python_home
- $install_log = $python_home + ".log"
- $args = "/S /D=$python_home"
- Write-Host $filepath $args
- Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
- if (Test-Path $python_home) {
- Write-Host "Python $python_version ($architecture) installation complete"
- } else {
- Write-Host "Failed to install Python in $python_home"
- Get-Content -Path $install_log
- Exit 1
- }
-}
-
-
-function InstallMinicondaPip ($python_home) {
- $pip_path = $python_home + "\Scripts\pip.exe"
- $conda_path = $python_home + "\Scripts\conda.exe"
- if (-not(Test-Path $pip_path)) {
- Write-Host "Installing pip..."
- $args = "install --yes pip"
- Write-Host $conda_path $args
- Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
- } else {
- Write-Host "pip already installed."
- }
-}
-
-
-function main () {
- # Don't download mesa for now since AppVeyor is unreliable with it
- # DownloadMesaOpenGL $env:PYTHON_ARCH
- InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
- InstallMinicondaPip $env:PYTHON
-}
-
-main
diff --git a/make/make.py b/make/make.py
deleted file mode 100644
index 3193c2c..0000000
--- a/make/make.py
+++ /dev/null
@@ -1,543 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for mo
-
-"""
-Convenience tools for vispy developers
-
- make.py command [arg]
-
-"""
-
-from __future__ import division, print_function
-
-import sys
-import os
-from os import path as op
-import time
-import shutil
-import subprocess
-import re
-import webbrowser
-import traceback
-import numpy as np
-
-# Save where we came frome and where this module lives
-START_DIR = op.abspath(os.getcwd())
-THIS_DIR = op.abspath(op.dirname(__file__))
-
-# Get root directory of the package, by looking for setup.py
-for subdir in ['.', '..']:
- ROOT_DIR = op.abspath(op.join(THIS_DIR, subdir))
- if op.isfile(op.join(ROOT_DIR, 'setup.py')):
- break
-else:
- sys.exit('Cannot find root dir')
-
-
-# Define directories and repos of interest
-DOC_DIR = op.join(ROOT_DIR, 'doc')
-#
-WEBSITE_DIR = op.join(ROOT_DIR, '_website')
-WEBSITE_REPO = 'git at github.com:vispy/vispy-website'
-#
-PAGES_DIR = op.join(ROOT_DIR, '_gh-pages')
-PAGES_REPO = 'git at github.com:vispy/vispy.github.com.git'
-#
-IMAGES_DIR = op.join(ROOT_DIR, '_images')
-IMAGES_REPO = 'git at github.com:vispy/images.git'
-
-
-class Maker:
-
- """ Collection of make commands.
-
- To create a new command, create a method with a short name, give it
- a docstring, and make it do something useful :)
-
- """
-
- def __init__(self, argv):
- """ Parse command line arguments. """
- # Get function to call
- if len(argv) == 1:
- func, arg = self.help, ''
- else:
- command = argv[1].strip()
- arg = ' '.join(argv[2:]).strip()
- func = getattr(self, command, None)
- # Call it if we can
- if func is not None:
- func(arg)
- else:
- sys.exit('Invalid command: "%s"' % command)
-
- def coverage_html(self, arg):
- """Generate html report from .coverage and launch"""
- print('Generating HTML...')
- from coverage import coverage
- cov = coverage(auto_data=False, branch=True, data_suffix=None,
- source=['vispy']) # should match testing/_coverage.py
- cov.combine()
- cov.load()
- cov.html_report()
- print('Done, launching browser.')
- fname = op.join(os.getcwd(), 'htmlcov', 'index.html')
- if not op.isfile(fname):
- raise IOError('Generated file not found: %s' % fname)
- webbrowser.open_new_tab(fname)
-
- def help(self, arg):
- """ Show help message. Use 'help X' to get more help on command X. """
- if arg:
- command = arg
- func = getattr(self, command, None)
- if func is not None:
- doc = getattr(self, command).__doc__.strip()
- print('make.py %s [arg]\n\n %s' % (command, doc))
- print()
- else:
- sys.exit('Cannot show help on unknown command: "%s"' % command)
-
- else:
- print(__doc__.strip() + '\n\nCommands:\n')
- for command in sorted(dir(self)):
- if command.startswith('_'):
- continue
- preamble = command.ljust(11) # longest command is 9 or 10
- # doc = getattr(self, command).__doc__.splitlines()[0].strip()
- doc = getattr(self, command).__doc__.strip()
- print(' %s %s' % (preamble, doc))
- print()
-
- def doc(self, arg):
- """ Make API documentation. Subcommands:
- * html - build html
- * show - show the docs in your browser
- """
- # Prepare
- build_dir = op.join(DOC_DIR, '_build')
- if not arg:
- return self.help('doc')
- # Go
- if 'html' == arg:
- sphinx_clean(build_dir)
- sphinx_build(DOC_DIR, build_dir)
- elif 'show' == arg:
- sphinx_show(op.join(build_dir, 'html'))
- else:
- sys.exit('Command "doc" does not have subcommand "%s"' % arg)
-
- def website(self, arg):
- """ Build website. Website source is put in '_website'. Subcommands:
- * html - build html
- * show - show the website in your browser
- * upload - upload (commit+push) the resulting html to github
- """
- # Prepare
- build_dir = op.join(WEBSITE_DIR, '_build')
- html_dir = op.join(build_dir, 'html')
-
- # Clone repo for website if needed, make up-to-date otherwise
- if not op.isdir(WEBSITE_DIR):
- os.chdir(ROOT_DIR)
- sh("git clone %s %s" % (WEBSITE_REPO, WEBSITE_DIR))
- else:
- print('Updating website repo')
- os.chdir(WEBSITE_DIR)
- sh('git pull')
-
- if not arg:
- return self.help('website')
-
- # Go
- if 'html' == arg:
- sphinx_clean(build_dir)
- try:
- sphinx_build(WEBSITE_DIR, build_dir)
- except SystemExit as err:
- if err.code:
- raise
- sphinx_copy_pages(html_dir, PAGES_DIR, PAGES_REPO)
- elif 'show' == arg:
- sphinx_show(PAGES_DIR)
- elif 'upload' == arg:
- sphinx_upload(PAGES_DIR)
- print()
- print(
- "Do not forget to also commit+push your changes to '_website'")
- else:
- sys.exit('Command "website" does not have subcommand "%s"' % arg)
-
- def test(self, arg):
- """ Run tests:
- * full - run all tests
- * unit - run tests (also for each backend)
- * any backend name (e.g. pyside, pyqt4, etc.) -
- run tests for the given backend
- * nobackend - run tests that do not require a backend
- * extra - run extra tests (line endings and style)
- * lineendings - test line ending consistency
- * flake - flake style testing (PEP8 and more)
- * examples - run all examples
- * examples [examples paths] - run given examples
- """
- if not arg:
- return self.help('test')
- from vispy import test
- try:
- args = arg.split(' ')
- test(args[0], ' '.join(args[1:]))
- except Exception as err:
- print(err)
- if not isinstance(err, RuntimeError):
- type_, value, tb = sys.exc_info()
- traceback.print_exception(type, value, tb)
- raise SystemExit(1)
-
- def images(self, arg):
- """ Create images (screenshots). Subcommands:
- * gallery - make screenshots for the gallery
- * test - make screenshots for testing
- * upload - upload the gallery images repository
- * clean - delete existing files
- """
-
- # Clone repo for images if needed, make up-to-date otherwise
- if not op.isdir(IMAGES_DIR):
- os.chdir(ROOT_DIR)
- sh("git clone %s %s" % (IMAGES_REPO, IMAGES_DIR))
- else:
- print('Updating images repo')
- os.chdir(IMAGES_DIR)
- sh('git pull')
-
- if not arg:
- return self.help('images')
-
- # Create subdirs if needed
- for subdir in ['gallery', 'thumbs', 'carousel', 'test']:
- subdir = op.join(IMAGES_DIR, subdir)
- if not op.isdir(subdir):
- os.mkdir(subdir)
-
- # Go
- if arg == 'gallery':
- self._images_screenshots()
- self._images_thumbnails()
- elif arg == 'test':
- sys.exit('images test command not yet implemented')
- elif arg == 'upload':
- sphinx_upload(IMAGES_DIR)
- elif arg == 'clean':
- self._images_delete()
- else:
- sys.exit('Command "images" does not have subcommand "%s"' % arg)
-
- def _images_delete(self):
- examples_dir = op.join(ROOT_DIR, 'examples')
- gallery_dir = op.join(IMAGES_DIR, 'gallery')
-
- # Process all files ...
- print('Deleting existing gallery images')
- n = 0
- tot = 0
- for filename, name in get_example_filenames(examples_dir):
- tot += 1
- name = name.replace('/', '__') # We use flat names
- imagefilename = op.join(gallery_dir, name + '.png')
- if op.isfile(imagefilename):
- n += 1
- os.remove(imagefilename)
- print('Removed %s of %s possible files' % (n, tot))
-
- def _images_screenshots(self):
- # Prepare
- import imp
- from vispy.io import imsave
- from vispy.gloo.util import _screenshot
- examples_dir = op.join(ROOT_DIR, 'examples')
- gallery_dir = op.join(IMAGES_DIR, 'gallery')
-
- # Process all files ...
- for filename, name in get_example_filenames(examples_dir):
- name = name.replace('/', '__') # We use flat names
- imagefilename = op.join(gallery_dir, name + '.png')
-
- # Check if we need to take a sceenshot
- if op.isfile(imagefilename):
- print('Skip: %s screenshot already present.' % name)
- continue
-
- # Check if should make a screenshot
- frames = []
- lines = open(filename, 'rt').read().splitlines()
- for line in lines[:10]:
- if line.startswith('# vispy:') and 'gallery' in line:
- # Get what frames to grab
- frames = line.split('gallery')[1].split(',')[0].strip()
- frames = frames or '0'
- frames = [int(i) for i in frames.split(':')]
- if not frames:
- frames = [0]
- if len(frames) > 1:
- frames = list(range(*frames))
- break
- else:
- print('Ignore: %s, no hint' % name)
- continue # gallery hint not found
-
- # Import module and prepare
- print('Grab: %s screenshots (%s)' % (name, len(frames)))
- try:
- m = imp.load_source('vispy_example_' + name, filename)
- except Exception as exp:
- print('*Err*: %s, got "%s"' % (name, str(exp)))
- m.done = False
- m.frame = -1
- m.images = []
-
- # Create a canvas and grab a screenshot
- def grabscreenshot(event):
- if m.done:
- return # Grab only once
- m.frame += 1
- if m.frame in frames:
- frames.remove(m.frame)
- im = _screenshot((0, 0, c.size[0], c.size[1]))
- # Ensure we don't have alpha silliness
- im = np.array(im)
- im[:, :, 3] = 255
- m.images.append(im)
- if not frames:
- m.done = True
- # Get canvas
- if hasattr(m, 'canvas'):
- c = m.canvas # scene examples
- elif hasattr(m, 'Canvas'):
- c = m.Canvas()
- elif hasattr(m, 'fig'):
- c = m.fig
- else:
- print('Ignore: %s, no canvas' % name)
- continue
- c.events.draw.connect(grabscreenshot)
- # Show it and draw as many frames as needed
- with c:
- n = 0
- limit = 10000
- while not m.done and n < limit:
- c.update()
- c.app.process_events()
- n += 1
- if n >= limit or len(frames) > 0:
- raise RuntimeError('Could not collect image for %s' % name)
- # Save
- imsave(imagefilename, m.images[0]) # Alwats show one image
- if len(m.images) > 1:
- import imageio # multiple gif not properly supported yet
- imageio.mimsave(imagefilename[:-3] + '.gif', m.images)
-
- def _images_thumbnails(self):
- from vispy.io import imsave, imread
- from skimage.transform import resize
- import numpy as np
- gallery_dir = op.join(IMAGES_DIR, 'gallery')
- thumbs_dir = op.join(IMAGES_DIR, 'thumbs')
- carousel_dir = op.join(IMAGES_DIR, 'carousel')
- for fname in os.listdir(gallery_dir):
- filename1 = op.join(gallery_dir, fname)
- filename2 = op.join(thumbs_dir, fname)
- filename3 = op.join(carousel_dir, fname)
- #
- im = imread(filename1)
-
- newx = 200
- newy = int(newx * im.shape[0] / im.shape[1])
- im = (resize(im, (newy, newx), 2) * 255).astype(np.uint8)
- imsave(filename2, im)
-
- newy = 160 # This should match the carousel size!
- newx = int(newy * im.shape[1] / im.shape[0])
- im = (resize(im, (newy, newx), 1) * 255).astype(np.uint8)
- imsave(filename3, im)
-
- print('Created thumbnail and carousel %s' % fname)
-
- def copyright(self, arg):
- """ Update all copyright notices to the current year.
- """
- # Initialize
- TEMPLATE = "# Copyright (c) %i, Vispy Development Team."
- CURYEAR = int(time.strftime('%Y'))
- OLDTEXT = TEMPLATE % (CURYEAR - 1)
- NEWTEXT = TEMPLATE % CURYEAR
- # Initialize counts
- count_ok, count_replaced = 0, 0
-
- # Processing the whole root directory
- for dirpath, dirnames, filenames in os.walk(ROOT_DIR):
- # Check if we should skip this directory
- reldirpath = op.relpath(dirpath, ROOT_DIR)
- if reldirpath[0] in '._' or reldirpath.endswith('__pycache__'):
- continue
- if op.split(reldirpath)[0] in ('build', 'dist'):
- continue
- # Process files
- for fname in filenames:
- if not fname.endswith('.py'):
- continue
- # Open and check
- filename = op.join(dirpath, fname)
- text = open(filename, 'rt').read()
- if NEWTEXT in text:
- count_ok += 1
- elif OLDTEXT in text:
- text = text.replace(OLDTEXT, NEWTEXT)
- open(filename, 'wt').write(text)
- print(
- ' Update copyright year in %s/%s' %
- (reldirpath, fname))
- count_replaced += 1
- elif 'copyright' in text[:200].lower():
- print(
- ' Unknown copyright mentioned in %s/%s' %
- (reldirpath, fname))
- # Report
- print('Replaced %i copyright statements' % count_replaced)
- print('Found %i copyright statements up to date' % count_ok)
-
-
-# Functions used by the maker
-
-if sys.version_info[0] < 3:
- input = raw_input # noqa
-
-
-def sh(cmd):
- """Execute command in a subshell, return status code."""
- return subprocess.check_call(cmd, shell=True)
-
-
-def sh2(cmd):
- """Execute command in a subshell, return stdout.
- Stderr is unbuffered from the subshell."""
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
- out = p.communicate()[0]
- retcode = p.returncode
- if retcode:
- raise subprocess.CalledProcessError(retcode, cmd)
- else:
- return out.rstrip().decode('utf-8', 'ignore')
-
-
-def sphinx_clean(build_dir):
- if op.isdir(build_dir):
- shutil.rmtree(build_dir)
- os.mkdir(build_dir)
- print('Cleared build directory.')
-
-
-def sphinx_build(src_dir, build_dir):
- import sphinx
- ret = sphinx.main(('sphinx-build', # Dummy
- '-b', 'html',
- '-d', op.join(build_dir, 'doctrees'),
- src_dir, # Source
- op.join(build_dir, 'html'), # Dest
- ))
- if ret != 0:
- raise RuntimeError('Sphinx error: %s' % ret)
- print("Build finished. The HTML pages are in %s/html." % build_dir)
-
-
-def sphinx_show(html_dir):
- index_html = op.join(html_dir, 'index.html')
- if not op.isfile(index_html):
- sys.exit('Cannot show pages, build the html first.')
- import webbrowser
- webbrowser.open_new_tab(index_html)
-
-
-def sphinx_copy_pages(html_dir, pages_dir, pages_repo):
- # Create the pages repo if needed
- if not op.isdir(pages_dir):
- os.chdir(ROOT_DIR)
- sh("git clone %s %s" % (pages_repo, pages_dir))
- # Ensure that its up to date
- os.chdir(pages_dir)
- sh('git checkout master -q')
- sh('git pull -q')
- os.chdir('..')
- # This is pretty unforgiving: we unconditionally nuke the destination
- # directory, and then copy the html tree in there
- tmp_git_dir = op.join(ROOT_DIR, pages_dir + '_git')
- shutil.move(op.join(pages_dir, '.git'), tmp_git_dir)
- try:
- shutil.rmtree(pages_dir)
- shutil.copytree(html_dir, pages_dir)
- shutil.move(tmp_git_dir, op.join(pages_dir, '.git'))
- finally:
- if op.isdir(tmp_git_dir):
- shutil.rmtree(tmp_git_dir)
- # Copy individual files
- for fname in ['CNAME', 'README.md', 'conf.py', '.nojekyll', 'Makefile']:
- shutil.copyfile(op.join(WEBSITE_DIR, fname),
- op.join(pages_dir, fname))
- # Messages
- os.chdir(pages_dir)
- sh('git status')
- print()
- print("Website copied to _gh-pages. Above you can see its status:")
- print(" Run 'make.py website show' to view.")
- print(" Run 'make.py website upload' to commit and push.")
-
-
-def sphinx_upload(repo_dir):
- # Check head
- os.chdir(repo_dir)
- status = sh2('git status | head -1')
- branch = re.match('On branch (.*)$', status).group(1)
- if branch != 'master':
- e = 'On %r, git branch is %r, MUST be "master"' % (repo_dir,
- branch)
- raise RuntimeError(e)
- # Show repo and ask confirmation
- print()
- print('You are about to commit to:')
- sh('git config --get remote.origin.url')
- print()
- print('Most recent 3 commits:')
- sys.stdout.flush()
- sh('git --no-pager log --oneline -n 3')
- ok = input('Are you sure you want to commit and push? (y/[n]): ')
- ok = ok or 'n'
- # If ok, add, commit, push
- if ok.lower() == 'y':
- sh('git add .')
- sh('git commit -am"Update (automated commit)"')
- print()
- sh('git push')
-
-
-def get_example_filenames(example_dir):
- """ Yield (filename, name) elements for all examples. The examples
- are organized in directories, therefore the name can contain a
- forward slash.
- """
- for (dirpath, dirnames, filenames) in os.walk(example_dir):
- for fname in sorted(filenames):
- if not fname.endswith('.py'):
- continue
- filename = op.join(dirpath, fname)
- name = filename[len(example_dir):].lstrip('/\\')[:-3]
- name = name.replace('\\', '/')
- yield filename, name
-
-
-if __name__ == '__main__':
- try:
- m = Maker(sys.argv)
- finally:
- os.chdir(START_DIR)
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..861a9f5
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,5 @@
+[egg_info]
+tag_build =
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/stdeb.cfg b/stdeb.cfg
deleted file mode 100644
index bde0e47..0000000
--- a/stdeb.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-[DEFAULT]
-Package: python-vispy
-XS-Python-Version: >= 2.6
-Maintainer: Jerome Kieffer <jerome.kieffer at esrf.fr>
-Build-Depends: python-opengl
-Recommends: python-numpy
-
diff --git a/vispy.egg-info/PKG-INFO b/vispy.egg-info/PKG-INFO
new file mode 100644
index 0000000..ec56206
--- /dev/null
+++ b/vispy.egg-info/PKG-INFO
@@ -0,0 +1,40 @@
+Metadata-Version: 1.1
+Name: vispy
+Version: 0.4.0
+Summary: Interactive visualization in Python
+Home-page: http://vispy.org
+Author: Vispy contributors
+Author-email: vispy at googlegroups.com
+License: (new) BSD
+Download-URL: https://pypi.python.org/pypi/vispy
+Description:
+
+ =====
+ Vispy
+ =====
+
+ Vispy is a **high-performance interactive 2D/3D data visualization
+ library**. Vispy leverages the computational power of modern **Graphics
+ Processing Units (GPUs)** through the **OpenGL** library to display very
+ large datasets.
+
+ For more information, see http://vispy.org.
+
+
+Keywords: visualization OpenGl ES medical imaging 3D plotting numpy bigdata
+Platform: any
+Classifier: Development Status :: 3 - Alpha
+Classifier: Intended Audience :: Science/Research
+Classifier: Intended Audience :: Education
+Classifier: Intended Audience :: Developers
+Classifier: Topic :: Scientific/Engineering :: Visualization
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Provides: vispy
diff --git a/vispy.egg-info/SOURCES.txt b/vispy.egg-info/SOURCES.txt
new file mode 100644
index 0000000..8bcef0a
--- /dev/null
+++ b/vispy.egg-info/SOURCES.txt
@@ -0,0 +1,447 @@
+README.rst
+setup.py
+vispy/__init__.py
+vispy.egg-info/PKG-INFO
+vispy.egg-info/SOURCES.txt
+vispy.egg-info/dependency_links.txt
+vispy.egg-info/not-zip-safe
+vispy.egg-info/requires.txt
+vispy.egg-info/top_level.txt
+vispy/app/__init__.py
+vispy/app/_default_app.py
+vispy/app/application.py
+vispy/app/base.py
+vispy/app/canvas.py
+vispy/app/inputhook.py
+vispy/app/qt.py
+vispy/app/timer.py
+vispy/app/backends/__init__.py
+vispy/app/backends/_egl.py
+vispy/app/backends/_glfw.py
+vispy/app/backends/_ipynb_static.py
+vispy/app/backends/_ipynb_util.py
+vispy/app/backends/_ipynb_vnc.py
+vispy/app/backends/_ipynb_webgl.py
+vispy/app/backends/_pyglet.py
+vispy/app/backends/_pyqt4.py
+vispy/app/backends/_pyqt5.py
+vispy/app/backends/_pyside.py
+vispy/app/backends/_qt.py
+vispy/app/backends/_sdl2.py
+vispy/app/backends/_template.py
+vispy/app/backends/_test.py
+vispy/app/backends/_wx.py
+vispy/app/backends/ipython/__init__.py
+vispy/app/backends/ipython/_widget.py
+vispy/app/backends/tests/__init__.py
+vispy/app/backends/tests/test_ipynb_util.py
+vispy/app/tests/__init__.py
+vispy/app/tests/qt-designer.ui
+vispy/app/tests/test_app.py
+vispy/app/tests/test_backends.py
+vispy/app/tests/test_context.py
+vispy/app/tests/test_interactive.py
+vispy/app/tests/test_qt.py
+vispy/app/tests/test_simultaneous.py
+vispy/color/__init__.py
+vispy/color/_color_dict.py
+vispy/color/color_array.py
+vispy/color/color_space.py
+vispy/color/colormap.py
+vispy/color/tests/__init__.py
+vispy/color/tests/test_color.py
+vispy/ext/__init__.py
+vispy/ext/_mpl_py3k_compat.py
+vispy/ext/cocoapy.py
+vispy/ext/cubehelix.py
+vispy/ext/decorator.py
+vispy/ext/egl.py
+vispy/ext/fontconfig.py
+vispy/ext/freetype.py
+vispy/ext/gdi32plus.py
+vispy/ext/glfw.py
+vispy/ext/gzip_open.py
+vispy/ext/ipy_inputhook.py
+vispy/ext/mplexporter.py
+vispy/ext/mplutils.py
+vispy/ext/ordereddict.py
+vispy/ext/png.py
+vispy/ext/py24_ordereddict.py
+vispy/ext/six.py
+vispy/geometry/__init__.py
+vispy/geometry/_triangulation_debugger.py
+vispy/geometry/calculations.py
+vispy/geometry/generation.py
+vispy/geometry/isocurve.py
+vispy/geometry/isosurface.py
+vispy/geometry/meshdata.py
+vispy/geometry/normals.py
+vispy/geometry/parametric.py
+vispy/geometry/polygon.py
+vispy/geometry/rect.py
+vispy/geometry/torusknot.py
+vispy/geometry/triangulation.py
+vispy/geometry/tests/__init__.py
+vispy/geometry/tests/test_calculations.py
+vispy/geometry/tests/test_generation.py
+vispy/geometry/tests/test_meshdata.py
+vispy/geometry/tests/test_triangulation.py
+vispy/gloo/__init__.py
+vispy/gloo/buffer.py
+vispy/gloo/context.py
+vispy/gloo/framebuffer.py
+vispy/gloo/glir.py
+vispy/gloo/globject.py
+vispy/gloo/preprocessor.py
+vispy/gloo/program.py
+vispy/gloo/texture.py
+vispy/gloo/util.py
+vispy/gloo/wrappers.py
+vispy/gloo/gl/__init__.py
+vispy/gloo/gl/_constants.py
+vispy/gloo/gl/_es2.py
+vispy/gloo/gl/_gl2.py
+vispy/gloo/gl/_proxy.py
+vispy/gloo/gl/_pyopengl2.py
+vispy/gloo/gl/dummy.py
+vispy/gloo/gl/es2.py
+vispy/gloo/gl/gl2.py
+vispy/gloo/gl/glplus.py
+vispy/gloo/gl/pyopengl2.py
+vispy/gloo/gl/tests/__init__.py
+vispy/gloo/gl/tests/test_basics.py
+vispy/gloo/gl/tests/test_functionality.py
+vispy/gloo/gl/tests/test_names.py
+vispy/gloo/gl/tests/test_use.py
+vispy/gloo/tests/__init__.py
+vispy/gloo/tests/test_buffer.py
+vispy/gloo/tests/test_context.py
+vispy/gloo/tests/test_framebuffer.py
+vispy/gloo/tests/test_glir.py
+vispy/gloo/tests/test_globject.py
+vispy/gloo/tests/test_program.py
+vispy/gloo/tests/test_texture.py
+vispy/gloo/tests/test_use_gloo.py
+vispy/gloo/tests/test_util.py
+vispy/gloo/tests/test_wrappers.py
+vispy/glsl/__init__.py
+vispy/glsl/build-spatial-filters.py
+vispy/glsl/antialias/__init__.py
+vispy/glsl/antialias/antialias.glsl
+vispy/glsl/antialias/cap-butt.glsl
+vispy/glsl/antialias/cap-round.glsl
+vispy/glsl/antialias/cap-square.glsl
+vispy/glsl/antialias/cap-triangle-in.glsl
+vispy/glsl/antialias/cap-triangle-out.glsl
+vispy/glsl/antialias/cap.glsl
+vispy/glsl/antialias/caps.glsl
+vispy/glsl/antialias/filled.glsl
+vispy/glsl/antialias/outline.glsl
+vispy/glsl/antialias/stroke.glsl
+vispy/glsl/arrows/__init__.py
+vispy/glsl/arrows/angle-30.glsl
+vispy/glsl/arrows/angle-60.glsl
+vispy/glsl/arrows/angle-90.glsl
+vispy/glsl/arrows/arrow.frag
+vispy/glsl/arrows/arrow.vert
+vispy/glsl/arrows/arrows.glsl
+vispy/glsl/arrows/common.glsl
+vispy/glsl/arrows/curved.glsl
+vispy/glsl/arrows/stealth.glsl
+vispy/glsl/arrows/triangle-30.glsl
+vispy/glsl/arrows/triangle-60.glsl
+vispy/glsl/arrows/triangle-90.glsl
+vispy/glsl/arrows/util.glsl
+vispy/glsl/collections/__init__.py
+vispy/glsl/collections/agg-fast-path.frag
+vispy/glsl/collections/agg-fast-path.vert
+vispy/glsl/collections/agg-glyph.frag
+vispy/glsl/collections/agg-glyph.vert
+vispy/glsl/collections/agg-marker.frag
+vispy/glsl/collections/agg-marker.vert
+vispy/glsl/collections/agg-path.frag
+vispy/glsl/collections/agg-path.vert
+vispy/glsl/collections/agg-point.frag
+vispy/glsl/collections/agg-point.vert
+vispy/glsl/collections/agg-segment.frag
+vispy/glsl/collections/agg-segment.vert
+vispy/glsl/collections/marker.frag
+vispy/glsl/collections/marker.vert
+vispy/glsl/collections/raw-path.frag
+vispy/glsl/collections/raw-path.vert
+vispy/glsl/collections/raw-point.frag
+vispy/glsl/collections/raw-point.vert
+vispy/glsl/collections/raw-segment.frag
+vispy/glsl/collections/raw-segment.vert
+vispy/glsl/collections/raw-triangle.frag
+vispy/glsl/collections/raw-triangle.vert
+vispy/glsl/collections/sdf-glyph-ticks.vert
+vispy/glsl/collections/sdf-glyph.frag
+vispy/glsl/collections/sdf-glyph.vert
+vispy/glsl/collections/tick-labels.vert
+vispy/glsl/colormaps/__init__.py
+vispy/glsl/colormaps/autumn.glsl
+vispy/glsl/colormaps/blues.glsl
+vispy/glsl/colormaps/color-space.glsl
+vispy/glsl/colormaps/colormaps.glsl
+vispy/glsl/colormaps/cool.glsl
+vispy/glsl/colormaps/fire.glsl
+vispy/glsl/colormaps/gray.glsl
+vispy/glsl/colormaps/greens.glsl
+vispy/glsl/colormaps/hot.glsl
+vispy/glsl/colormaps/ice.glsl
+vispy/glsl/colormaps/icefire.glsl
+vispy/glsl/colormaps/parse.py
+vispy/glsl/colormaps/reds.glsl
+vispy/glsl/colormaps/spring.glsl
+vispy/glsl/colormaps/summer.glsl
+vispy/glsl/colormaps/user.glsl
+vispy/glsl/colormaps/util.glsl
+vispy/glsl/colormaps/wheel.glsl
+vispy/glsl/colormaps/winter.glsl
+vispy/glsl/markers/__init__.py
+vispy/glsl/markers/arrow.glsl
+vispy/glsl/markers/asterisk.glsl
+vispy/glsl/markers/chevron.glsl
+vispy/glsl/markers/clover.glsl
+vispy/glsl/markers/club.glsl
+vispy/glsl/markers/cross.glsl
+vispy/glsl/markers/diamond.glsl
+vispy/glsl/markers/disc.glsl
+vispy/glsl/markers/ellipse.glsl
+vispy/glsl/markers/hbar.glsl
+vispy/glsl/markers/heart.glsl
+vispy/glsl/markers/infinity.glsl
+vispy/glsl/markers/marker-sdf.frag
+vispy/glsl/markers/marker-sdf.vert
+vispy/glsl/markers/marker.frag
+vispy/glsl/markers/marker.vert
+vispy/glsl/markers/markers.glsl
+vispy/glsl/markers/pin.glsl
+vispy/glsl/markers/ring.glsl
+vispy/glsl/markers/spade.glsl
+vispy/glsl/markers/square.glsl
+vispy/glsl/markers/tag.glsl
+vispy/glsl/markers/triangle.glsl
+vispy/glsl/markers/vbar.glsl
+vispy/glsl/math/__init__.py
+vispy/glsl/math/circle-through-2-points.glsl
+vispy/glsl/math/constants.glsl
+vispy/glsl/math/double.glsl
+vispy/glsl/math/functions.glsl
+vispy/glsl/math/point-to-line-distance.glsl
+vispy/glsl/math/point-to-line-projection.glsl
+vispy/glsl/math/signed-line-distance.glsl
+vispy/glsl/math/signed-segment-distance.glsl
+vispy/glsl/misc/__init__.py
+vispy/glsl/misc/regular-grid.frag
+vispy/glsl/misc/spatial-filters.frag
+vispy/glsl/misc/viewport-NDC.glsl
+vispy/glsl/transforms/__init__.py
+vispy/glsl/transforms/azimuthal-equal-area.glsl
+vispy/glsl/transforms/azimuthal-equidistant.glsl
+vispy/glsl/transforms/hammer.glsl
+vispy/glsl/transforms/identity.glsl
+vispy/glsl/transforms/identity_forward.glsl
+vispy/glsl/transforms/identity_inverse.glsl
+vispy/glsl/transforms/linear-scale.glsl
+vispy/glsl/transforms/log-scale.glsl
+vispy/glsl/transforms/mercator-transverse-forward.glsl
+vispy/glsl/transforms/mercator-transverse-inverse.glsl
+vispy/glsl/transforms/panzoom.glsl
+vispy/glsl/transforms/polar.glsl
+vispy/glsl/transforms/position.glsl
+vispy/glsl/transforms/power-scale.glsl
+vispy/glsl/transforms/projection.glsl
+vispy/glsl/transforms/pvm.glsl
+vispy/glsl/transforms/rotate.glsl
+vispy/glsl/transforms/trackball.glsl
+vispy/glsl/transforms/translate.glsl
+vispy/glsl/transforms/transverse_mercator.glsl
+vispy/glsl/transforms/viewport-clipping.glsl
+vispy/glsl/transforms/viewport-transform.glsl
+vispy/glsl/transforms/viewport.glsl
+vispy/glsl/transforms/x.glsl
+vispy/glsl/transforms/y.glsl
+vispy/glsl/transforms/z.glsl
+vispy/html/static/js/jquery.mousewheel.min.js
+vispy/html/static/js/vispy.min.js
+vispy/html/static/js/webgl-backend.js
+vispy/io/__init__.py
+vispy/io/datasets.py
+vispy/io/image.py
+vispy/io/mesh.py
+vispy/io/wavefront.py
+vispy/io/_data/spatial-filters.npy
+vispy/io/tests/__init__.py
+vispy/io/tests/test_image.py
+vispy/io/tests/test_io.py
+vispy/mpl_plot/__init__.py
+vispy/mpl_plot/_mpl_to_vispy.py
+vispy/mpl_plot/tests/__init__.py
+vispy/mpl_plot/tests/test_show_vispy.py
+vispy/plot/__init__.py
+vispy/plot/fig.py
+vispy/plot/plotwidget.py
+vispy/plot/tests/__init__.py
+vispy/plot/tests/test_plot.py
+vispy/scene/__init__.py
+vispy/scene/canvas.py
+vispy/scene/events.py
+vispy/scene/node.py
+vispy/scene/subscene.py
+vispy/scene/systems.py
+vispy/scene/visuals.py
+vispy/scene/cameras/__init__.py
+vispy/scene/cameras/cameras.py
+vispy/scene/cameras/magnify.py
+vispy/scene/tests/__init__.py
+vispy/scene/tests/test_node.py
+vispy/scene/tests/test_visuals.py
+vispy/scene/widgets/__init__.py
+vispy/scene/widgets/anchor.py
+vispy/scene/widgets/console.py
+vispy/scene/widgets/grid.py
+vispy/scene/widgets/viewbox.py
+vispy/scene/widgets/widget.py
+vispy/testing/__init__.py
+vispy/testing/_runners.py
+vispy/testing/_testing.py
+vispy/testing/image_tester.py
+vispy/testing/tests/__init__.py
+vispy/testing/tests/test_testing.py
+vispy/util/__init__.py
+vispy/util/bunch.py
+vispy/util/config.py
+vispy/util/eq.py
+vispy/util/event.py
+vispy/util/fetching.py
+vispy/util/filter.py
+vispy/util/fourier.py
+vispy/util/keys.py
+vispy/util/logs.py
+vispy/util/profiler.py
+vispy/util/ptime.py
+vispy/util/quaternion.py
+vispy/util/transforms.py
+vispy/util/wrappers.py
+vispy/util/dpi/__init__.py
+vispy/util/dpi/_linux.py
+vispy/util/dpi/_quartz.py
+vispy/util/dpi/_win32.py
+vispy/util/dpi/tests/__init__.py
+vispy/util/dpi/tests/test_dpi.py
+vispy/util/fonts/__init__.py
+vispy/util/fonts/_freetype.py
+vispy/util/fonts/_quartz.py
+vispy/util/fonts/_triage.py
+vispy/util/fonts/_vispy_fonts.py
+vispy/util/fonts/_win32.py
+vispy/util/fonts/tests/__init__.py
+vispy/util/fonts/tests/test_font.py
+vispy/util/svg/__init__.py
+vispy/util/svg/base.py
+vispy/util/svg/color.py
+vispy/util/svg/element.py
+vispy/util/svg/geometry.py
+vispy/util/svg/group.py
+vispy/util/svg/length.py
+vispy/util/svg/number.py
+vispy/util/svg/path.py
+vispy/util/svg/shapes.py
+vispy/util/svg/style.py
+vispy/util/svg/svg.py
+vispy/util/svg/transform.py
+vispy/util/svg/transformable.py
+vispy/util/svg/viewport.py
+vispy/util/tests/__init__.py
+vispy/util/tests/test_config.py
+vispy/util/tests/test_docstring_parameters.py
+vispy/util/tests/test_emitter_group.py
+vispy/util/tests/test_event_emitter.py
+vispy/util/tests/test_fourier.py
+vispy/util/tests/test_import.py
+vispy/util/tests/test_key.py
+vispy/util/tests/test_logging.py
+vispy/util/tests/test_run.py
+vispy/util/tests/test_transforms.py
+vispy/util/tests/test_vispy.py
+vispy/visuals/__init__.py
+vispy/visuals/cube.py
+vispy/visuals/ellipse.py
+vispy/visuals/gridlines.py
+vispy/visuals/histogram.py
+vispy/visuals/image.py
+vispy/visuals/isocurve.py
+vispy/visuals/isoline.py
+vispy/visuals/isosurface.py
+vispy/visuals/line_plot.py
+vispy/visuals/markers.py
+vispy/visuals/mesh.py
+vispy/visuals/polygon.py
+vispy/visuals/rectangle.py
+vispy/visuals/regular_polygon.py
+vispy/visuals/spectrogram.py
+vispy/visuals/surface_plot.py
+vispy/visuals/tube.py
+vispy/visuals/visual.py
+vispy/visuals/volume.py
+vispy/visuals/xyz_axis.py
+vispy/visuals/collections/__init__.py
+vispy/visuals/collections/agg_fast_path_collection.py
+vispy/visuals/collections/agg_path_collection.py
+vispy/visuals/collections/agg_point_collection.py
+vispy/visuals/collections/agg_segment_collection.py
+vispy/visuals/collections/array_list.py
+vispy/visuals/collections/base_collection.py
+vispy/visuals/collections/collection.py
+vispy/visuals/collections/path_collection.py
+vispy/visuals/collections/point_collection.py
+vispy/visuals/collections/polygon_collection.py
+vispy/visuals/collections/raw_path_collection.py
+vispy/visuals/collections/raw_point_collection.py
+vispy/visuals/collections/raw_polygon_collection.py
+vispy/visuals/collections/raw_segment_collection.py
+vispy/visuals/collections/raw_triangle_collection.py
+vispy/visuals/collections/segment_collection.py
+vispy/visuals/collections/triangle_collection.py
+vispy/visuals/collections/util.py
+vispy/visuals/components/__init__.py
+vispy/visuals/components/clipper.py
+vispy/visuals/components/color.py
+vispy/visuals/components/color2.py
+vispy/visuals/components/component.py
+vispy/visuals/components/material.py
+vispy/visuals/components/normal.py
+vispy/visuals/components/texture.py
+vispy/visuals/components/vertex.py
+vispy/visuals/glsl/__init__.py
+vispy/visuals/glsl/antialiasing.py
+vispy/visuals/glsl/color.py
+vispy/visuals/line/__init__.py
+vispy/visuals/line/dash_atlas.py
+vispy/visuals/line/fragment.py
+vispy/visuals/line/line.py
+vispy/visuals/line/vertex.py
+vispy/visuals/shaders/__init__.py
+vispy/visuals/shaders/compiler.py
+vispy/visuals/shaders/expression.py
+vispy/visuals/shaders/function.py
+vispy/visuals/shaders/parsing.py
+vispy/visuals/shaders/program.py
+vispy/visuals/shaders/shader_object.py
+vispy/visuals/shaders/variable.py
+vispy/visuals/shaders/tests/__init__.py
+vispy/visuals/shaders/tests/test_function.py
+vispy/visuals/shaders/tests/test_parsing.py
+vispy/visuals/text/__init__.py
+vispy/visuals/text/_sdf.py
+vispy/visuals/text/text.py
+vispy/visuals/transforms/__init__.py
+vispy/visuals/transforms/_util.py
+vispy/visuals/transforms/base_transform.py
+vispy/visuals/transforms/chain.py
+vispy/visuals/transforms/interactive.py
+vispy/visuals/transforms/linear.py
+vispy/visuals/transforms/nonlinear.py
+vispy/visuals/transforms/transform_system.py
\ No newline at end of file
diff --git a/vispy.egg-info/dependency_links.txt b/vispy.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/vispy.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/vispy.egg-info/not-zip-safe b/vispy.egg-info/not-zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/vispy.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/vispy.egg-info/requires.txt b/vispy.egg-info/requires.txt
new file mode 100644
index 0000000..24ce15a
--- /dev/null
+++ b/vispy.egg-info/requires.txt
@@ -0,0 +1 @@
+numpy
diff --git a/vispy.egg-info/top_level.txt b/vispy.egg-info/top_level.txt
new file mode 100644
index 0000000..498e1dd
--- /dev/null
+++ b/vispy.egg-info/top_level.txt
@@ -0,0 +1 @@
+vispy
diff --git a/vispy.proxy.py b/vispy.proxy.py
deleted file mode 100644
index 5f776cd..0000000
--- a/vispy.proxy.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2013, Almar Klein
-# (new) BSD License.
-
-"""
-This module provides an easy way to enable importing a package event
-if it's not on sys.path. The main use case is to import a package
-from its developmment repository without having to install it.
-
-This module is sort of like a symlink for Python modules.
-
-To install:
- 1) Copy this file to a directory that is on the PYTHONPATH
- 2) Rename the file to "yourpackage.py".
-
-If the real package is in "yourpackage/yourpackage" relative to this file,
-you're done. Otherwise modify PARENT_DIR_OF_MODULE.
-
-"""
-
-import os
-import sys
-
-# Determine directory and package name
-THIS_DIR = os.path.abspath(os.path.dirname(__file__))
-MODULE_NAME = __name__
-
-# Override if necessary
-PARENT_DIR_OF_MODULE = os.path.join(THIS_DIR, MODULE_NAME)
-
-
-# Insert in sys.path, so we can import the *real* package
-if not PARENT_DIR_OF_MODULE in sys.path:
- sys.path.insert(0, PARENT_DIR_OF_MODULE)
-
-# Remove *this* module from sys.modules, so we can import that name again
-# (keep reference to avoid premature cleanup)
-_old = sys.modules.pop(MODULE_NAME, None)
-
-# Import the *real* package. This will put the new package in
-# sys.modules. Note that the new package is injected in the namespace
-# from which "import package" is called; we do not need to import *.
-try:
- __import__(MODULE_NAME, level=0)
-except Exception as err:
- sys.modules[MODULE_NAME] = _old # Prevent KeyError
- raise
-
-
-# Clean up after ourselves
-if PARENT_DIR_OF_MODULE in sys.path:
- sys.path.remove(PARENT_DIR_OF_MODULE)
diff --git a/vispy/scene/cameras/tests/test_perspective.py b/vispy/scene/cameras/tests/test_perspective.py
deleted file mode 100644
index 6fb4798..0000000
--- a/vispy/scene/cameras/tests/test_perspective.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- coding: utf-8 -*-
-# -----------------------------------------------------------------------------
-# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-# -----------------------------------------------------------------------------
-from vispy import scene, io
-from vispy.testing import (requires_application, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_application()
-def test_perspective_render():
- with TestingCanvas(size=(300, 200)) as canvas:
-
- grid = canvas.central_widget.add_grid()
- grid.padding = 20
-
- imdata = io.load_crate().astype('float32') / 255
-
- views = []
- images = []
- for i, imethod in enumerate(['impostor', 'subdivide']):
- for j, vmethod in enumerate(['fragment', 'viewport', 'fbo']):
- v = grid.add_view(row=i, col=j, border_color='white')
- v.camera = 'turntable'
- v.camera.fov = 50
- v.camera.distance = 30
- v.clip_method = vmethod
-
- views.append(v)
- image = scene.visuals.Image(imdata, method=imethod,
- grid=(4, 4))
- image.transform = scene.STTransform(translate=(-12.8, -12.8),
- scale=(0.1, 0.1))
- v.add(image)
- images.append(image)
-
- image = canvas.render()
- print("ViewBox shapes")
- for v in views:
- print(v.node_transform(canvas.canvas_cs).map(v.rect))
- canvas.close()
-
- # Allow many pixels to differ by a small amount--texture sampling and
- # exact triangle position will differ across platforms. However a
- # change in perspective or in the widget borders should trigger a
- # failure.
- assert_image_approved(image, 'scene/cameras/perspective_test.png',
- 'perspective test 1: 6 identical views with '
- 'correct perspective',
- px_threshold=20,
- px_count=60,
- max_px_diff=200)
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_collections.py b/vispy/visuals/tests/test_collections.py
deleted file mode 100644
index c7a5bfe..0000000
--- a/vispy/visuals/tests/test_collections.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# *Very* basic collections tests
-
-from vispy.visuals.collections import (PathCollection, PointCollection,
- PolygonCollection, SegmentCollection,
- TriangleCollection)
-from vispy.testing import requires_application, TestingCanvas
-
-
- at requires_application()
-def test_init():
- """Test collection initialization
- """
- with TestingCanvas():
- for coll in (PathCollection, PointCollection, PolygonCollection,
- SegmentCollection, TriangleCollection):
- coll()
diff --git a/vispy/visuals/tests/test_ellipse.py b/vispy/visuals/tests/test_ellipse.py
deleted file mode 100644
index d30cdd6..0000000
--- a/vispy/visuals/tests/test_ellipse.py
+++ /dev/null
@@ -1,123 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Tests for EllipseVisual
-All images are of size (100,100) to keep a small file size
-"""
-
-from vispy.scene import visuals, transforms
-from vispy.testing import (requires_application, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_application()
-def test_circle_draw():
- """Test drawing circles without transform using EllipseVisual"""
- with TestingCanvas() as c:
- ellipse = visuals.Ellipse(pos=(75, 35, 0), radius=20,
- color=(1, 0, 0, 1))
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/circle1.png')
-
- ellipse = visuals.Ellipse(pos=(75, 35, 0), radius=20,
- color=(1, 0, 0, 1),
- border_color=(0, 1, 1, 1))
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/circle2.png')
-
- ellipse = visuals.Ellipse(pos=(75, 35, 0), radius=20,
- border_color=(0, 1, 1, 1))
- c.draw_visual(ellipse)
- # low corr here because borders have some variability
- # esp. w/HiDPI
- assert_image_approved("screenshot", 'visuals/circle3.png',
- min_corr=0.7)
-
-
- at requires_application()
-def test_ellipse_draw():
- """Test drawing transformed ellipses using EllipseVisual"""
- with TestingCanvas() as c:
- ellipse = visuals.Ellipse(pos=(0., 0.), radius=(20, 15),
- color=(0, 0, 1, 1))
- ellipse.transform = transforms.STTransform(scale=(2.0, 3.0),
- translate=(50, 50))
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/ellipse1.png')
-
- ellipse = visuals.Ellipse(pos=(0., 0.), radius=(20, 15),
- color=(0, 0, 1, 1),
- border_color=(1, 0, 0, 1))
- ellipse.transform = transforms.STTransform(scale=(2.0, 3.0),
- translate=(50, 50))
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/ellipse2.png')
-
- ellipse = visuals.Ellipse(pos=(0., 0.), radius=(20, 15),
- border_color=(1, 0, 0, 1))
- ellipse.transform = transforms.STTransform(scale=(2.0, 3.0),
- translate=(50, 50))
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/ellipse3.png',
- min_corr=0.7)
-
-
- at requires_application()
-def test_arc_draw1():
- """Test drawing arcs using EllipseVisual"""
- with TestingCanvas() as c:
- ellipse = visuals.Ellipse(pos=(50., 50.), radius=(20, 15),
- start_angle=150., span_angle=120.,
- color=(0, 0, 1, 1))
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/arc1.png')
-
- ellipse = visuals.Ellipse(pos=(50., 50.), radius=(20, 15),
- start_angle=150., span_angle=120.,
- border_color=(1, 0, 0, 1))
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/arc2.png',
- min_corr=0.6)
-
-
- at requires_application()
-def test_reactive_draw():
- """Test reactive ellipse attributes"""
- with TestingCanvas() as c:
- ellipse = visuals.Ellipse(pos=[75, 35, 0.], radius=[20, 15],
- color='yellow')
- c.draw_visual(ellipse)
-
- ellipse.pos = [70, 40, 0.]
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/reactive_ellipse1.png')
-
- ellipse.radius = 25
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/reactive_ellipse2.png')
-
- ellipse.color = 'red'
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/reactive_ellipse3.png')
-
- ellipse.border_color = 'yellow'
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/reactive_ellipse4.png')
-
- ellipse.start_angle = 140.
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/reactive_ellipse5.png')
-
- ellipse.span_angle = 100.
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/reactive_ellipse6.png')
-
- ellipse.num_segments = 10.
- c.draw_visual(ellipse)
- assert_image_approved("screenshot", 'visuals/reactive_ellipse7.png')
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_histogram.py b/vispy/visuals/tests/test_histogram.py
deleted file mode 100644
index 251c801..0000000
--- a/vispy/visuals/tests/test_histogram.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-import numpy as np
-
-from vispy.visuals.transforms import STTransform
-from vispy.scene.visuals import Histogram
-from vispy.testing import (requires_application, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_application()
-def test_histogram():
- """Test histogram visual"""
- size = (200, 100)
- with TestingCanvas(size=size, bgcolor='w') as c:
- np.random.seed(2397)
- data = np.random.normal(size=100)
- hist = Histogram(data, bins=20, color='k')
- hist.transform = STTransform((size[0] // 10, -size[1] // 20, 1),
- (100, size[1]))
- c.draw_visual(hist)
- assert_image_approved("screenshot", "visuals/histogram.png")
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_image.py b/vispy/visuals/tests/test_image.py
deleted file mode 100644
index 4723b0b..0000000
--- a/vispy/visuals/tests/test_image.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- coding: utf-8 -*-
-import numpy as np
-
-from vispy.scene.visuals import Image
-from vispy.testing import (requires_application, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_application()
-def test_image():
- """Test image visual"""
- size = (100, 50)
- with TestingCanvas(size=size, bgcolor='w') as c:
- for three_d in (True, False):
- shape = (size[1]-10, size[0]-10) + ((3,) if three_d else ())
- np.random.seed(379823)
- data = np.random.rand(*shape)
- image = Image(data, cmap='grays', clim=[0, 1])
- c.draw_visual(image)
- assert_image_approved("screenshot", "visuals/image%s.png" %
- ("_rgb" if three_d else "_mono"))
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_markers.py b/vispy/visuals/tests/test_markers.py
deleted file mode 100644
index afb0121..0000000
--- a/vispy/visuals/tests/test_markers.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- coding: utf-8 -*-
-import numpy as np
-from vispy.scene.visuals import Markers
-from vispy.testing import (requires_application, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_application()
-def test_markers():
- """Test basic marker / point-sprite support"""
- # this is probably too basic, but it at least ensures that point sprites
- # work for people
- np.random.seed(57983)
- data = np.random.normal(size=(30, 2), loc=50, scale=10)
-
- with TestingCanvas() as c:
- marker = Markers()
- marker.set_data(data)
- c.draw_visual(marker)
- assert_image_approved("screenshot", "visuals/markers.png")
-
- # Test good correlation at high-dpi
- with TestingCanvas(px_scale=2) as c:
- marker = Markers()
- marker.set_data(data)
- c.draw_visual(marker)
- assert_image_approved("screenshot", "visuals/markers.png")
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_polygon.py b/vispy/visuals/tests/test_polygon.py
deleted file mode 100644
index 391703e..0000000
--- a/vispy/visuals/tests/test_polygon.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# -*- coding: utf-8 -*-
-
-"""
-Tests for PolygonVisual
-All images are of size (100,100) to keep a small file size
-"""
-
-import numpy as np
-
-from vispy.scene import visuals, transforms
-from vispy.testing import (requires_application, requires_scipy, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_application()
- at requires_scipy()
-def test_square_draw():
- """Test drawing squares without transforms using PolygonVisual"""
- pos = np.array([[-0.5, 0.5, 0],
- [0.5, 0.5, 0],
- [0.5, -0.5, 0],
- [-0.5, -0.5, 0]])
- with TestingCanvas() as c:
- polygon = visuals.Polygon(pos=pos, color=(1, 0, 0, 1))
- polygon.transform = transforms.STTransform(scale=(50, 50),
- translate=(50, 50))
- c.draw_visual(polygon)
- assert_image_approved("screenshot", 'visuals/square1.png')
-
- polygon = visuals.Polygon(pos=pos, color=(1, 0, 0, 1),
- border_color=(1, 1, 1, 1))
- polygon.transform = transforms.STTransform(scale=(50, 50),
- translate=(50, 50))
- c.draw_visual(polygon)
- assert_image_approved("screenshot", 'visuals/square2.png')
-
- polygon = visuals.Polygon(pos=pos, border_color=(1, 1, 1, 1))
- polygon.transform = transforms.STTransform(scale=(50, 50),
- translate=(50, 50))
- c.draw_visual(polygon)
- assert_image_approved("screenshot", 'visuals/square3.png',
- min_corr=0.45)
-
-
- at requires_application()
- at requires_scipy()
-def test_rectangle_draw():
- """Test drawing rectangles with transforms using PolygonVisual"""
- pos = np.array([[-0.1, 0.5, 0],
- [0.1, 0.5, 0],
- [0.1, -0.5, 0],
- [-0.1, -0.5, 0]])
- with TestingCanvas() as c:
- polygon = visuals.Polygon(pos=pos, color=(1, 1, 0, 1))
- polygon.transform = transforms.STTransform(scale=(200.0, 25),
- translate=(50, 50))
- c.draw_visual(polygon)
- assert_image_approved("screenshot", 'visuals/rectangle1.png')
-
- polygon = visuals.Polygon(pos=pos, color=(1, 1, 0, 1),
- border_color=(1, 0, 0, 1))
- polygon.transform = transforms.STTransform(scale=(200.0, 25),
- translate=(50, 50))
- c.draw_visual(polygon)
- assert_image_approved("screenshot", 'visuals/rectangle2.png')
-
- polygon = visuals.Polygon(pos=pos, border_color=(1, 0, 0, 1),
- border_width=1)
- polygon.transform = transforms.STTransform(scale=(200.0, 25),
- translate=(50, 49))
- c.draw_visual(polygon)
- assert_image_approved("screenshot", 'visuals/rectangle3.png',
- min_corr=0.7)
-
-
- at requires_application()
- at requires_scipy()
-def test_reactive_draw():
- """Test reactive polygon attributes"""
- pos = np.array([[-0.1, 0.5, 0],
- [0.1, 0.5, 0],
- [0.1, -0.5, 0],
- [-0.1, -0.5, 0]])
- with TestingCanvas() as c:
- polygon = visuals.Polygon(pos=pos, color='yellow')
- polygon.transform = transforms.STTransform(scale=(50, 50),
- translate=(50, 50))
- c.draw_visual(polygon)
-
- polygon.pos += [0.1, -0.1, 0]
- c.draw_visual(polygon)
- assert_image_approved("screenshot", 'visuals/reactive_polygon1.png')
-
- polygon.color = 'red'
- c.draw_visual(polygon)
- assert_image_approved("screenshot", 'visuals/reactive_polygon2.png')
-
- polygon.border_color = 'yellow'
- c.draw_visual(polygon)
- assert_image_approved("screenshot", 'visuals/reactive_polygon3.png',
- min_corr=0.8)
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_rectangle.py b/vispy/visuals/tests/test_rectangle.py
deleted file mode 100644
index ce4ab3b..0000000
--- a/vispy/visuals/tests/test_rectangle.py
+++ /dev/null
@@ -1,138 +0,0 @@
-# -*- coding: utf-8 -*-
-
-"""
-Tests for RectPolygonVisual
-All images are of size (100,100) to keep a small file size
-"""
-
-from vispy.scene import visuals, transforms
-from vispy.testing import (requires_application, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-from pytest import raises
-
-
- at requires_application()
-def test_rectangle_draw():
- """Test drawing rectpolygons without transform using RectPolygonVisual"""
- with TestingCanvas() as c:
- rectpolygon = visuals.Rectangle(pos=(50, 50, 0), height=40.,
- width=80., color='red')
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot", 'visuals/rectpolygon1.png')
-
- rectpolygon = visuals.Rectangle(pos=(50, 50, 0), height=40.,
- width=80., radius=10., color='red')
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot", 'visuals/rectpolygon2.png')
-
- rectpolygon = visuals.Rectangle(pos=(50, 50, 0), height=40.,
- width=80., radius=10., color='red',
- border_color=(0, 1, 1, 1))
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot", 'visuals/rectpolygon3.png')
-
- rectpolygon = visuals.Rectangle(pos=(50, 50, 0), height=40.,
- width=80., radius=10.,
- border_color='white')
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot", 'visuals/rectpolygon4.png',
- min_corr=0.5)
-
- rectpolygon = visuals.Rectangle(pos=(50, 50, 0), height=60.,
- width=80., radius=[25, 10, 0, 15],
- color='red', border_color=(0, 1, 1, 1))
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot", 'visuals/rectpolygon5.png')
-
-
- at requires_application()
-def test_rectpolygon_draw():
- """Test drawing transformed rectpolygons using RectPolygonVisual"""
- with TestingCanvas() as c:
- rectpolygon = visuals.Rectangle(pos=(0., 0.), height=20.,
- width=20., radius=10., color='blue')
- rectpolygon.transform = transforms.STTransform(scale=(2.0, 3.0),
- translate=(50, 50))
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot", 'visuals/rectpolygon6.png')
-
- rectpolygon = visuals.Rectangle(pos=(0., 0.), height=20.,
- width=20., radius=10.,
- color='blue', border_color='red')
- rectpolygon.transform = transforms.STTransform(scale=(2.0, 3.0),
- translate=(50, 50))
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot", 'visuals/rectpolygon7.png')
-
- rectpolygon = visuals.Rectangle(pos=(0., 0.), height=60.,
- width=60., radius=10.,
- border_color='red')
- rectpolygon.transform = transforms.STTransform(scale=(1.5, 0.5),
- translate=(50, 50))
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot", 'visuals/rectpolygon8.png',
- min_corr=0.5)
-
- rectpolygon = visuals.Rectangle(pos=(0., 0.), height=60.,
- width=60., radius=[25, 10, 0, 15],
- color='blue', border_color='red')
- rectpolygon.transform = transforms.STTransform(scale=(1.5, 0.5),
- translate=(50, 50))
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot", 'visuals/rectpolygon9.png')
-
-
- at requires_application()
-def test_reactive_draw():
- """Test reactive RectPolygon attributes"""
- with TestingCanvas() as c:
- rectpolygon = visuals.Rectangle(pos=(50, 50, 0), height=40.,
- width=80., color='red')
- c.draw_visual(rectpolygon)
-
- rectpolygon.radius = [20., 20, 0., 10.]
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_rectpolygon1.png')
-
- rectpolygon.pos = (60, 60, 0)
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_rectpolygon2.png')
-
- rectpolygon.color = 'blue'
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_rectpolygon3.png')
-
- rectpolygon.border_color = 'yellow'
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_rectpolygon4.png')
-
- rectpolygon.radius = 10.
- c.draw_visual(rectpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_rectpolygon5.png')
-
-
- at requires_application()
-def test_attributes():
- """Test if attribute checks are in place"""
- with TestingCanvas():
- rectpolygon = visuals.Rectangle(pos=(50, 50, 0), height=40.,
- width=80., color='red')
- with raises(ValueError):
- rectpolygon.height = 0
- with raises(ValueError):
- rectpolygon.width = 0
- with raises(ValueError):
- rectpolygon.radius = [10, 0, 5]
- with raises(ValueError):
- rectpolygon.radius = [10.]
- with raises(ValueError):
- rectpolygon.radius = 21.
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_regular_polygon.py b/vispy/visuals/tests/test_regular_polygon.py
deleted file mode 100644
index 17f2063..0000000
--- a/vispy/visuals/tests/test_regular_polygon.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-"""
-Tests for RegularPolygonVisual
-All images are of size (100,100) to keep a small file size
-"""
-
-from vispy.scene import visuals, transforms
-from vispy.testing import (requires_application, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_application()
-def test_regular_polygon_draw1():
- """Test drawing regular polygons without transforms using RegularPolygonVisual""" # noqa
- with TestingCanvas() as c:
- rpolygon = visuals.RegularPolygon(pos=(0., 0.), radius=0.4, sides=8,
- color=(1, 0, 0, 1))
- rpolygon.transform = transforms.STTransform(scale=(50, 50),
- translate=(50, 50))
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot", 'visuals/regular_polygon1.png')
-
- rpolygon = visuals.RegularPolygon(pos=(0., 0.), radius=0.4, sides=8,
- color=(1, 0, 0, 1),
- border_color=(0, 1, 1, 1))
- rpolygon.transform = transforms.STTransform(scale=(50, 50),
- translate=(50, 50))
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot", 'visuals/regular_polygon2.png')
-
- rpolygon = visuals.RegularPolygon(pos=(0., 0.), radius=0.4, sides=8,
- border_color=(0, 1, 1, 1))
- rpolygon.transform = transforms.STTransform(scale=(50, 50),
- translate=(50, 50))
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot", 'visuals/regular_polygon3.png',
- min_corr=0.7)
-
-
- at requires_application()
-def test_regular_polygon_draw2():
- """Test drawing transformed regular polygons using RegularPolygonVisual""" # noqa
- with TestingCanvas() as c:
- rpolygon = visuals.RegularPolygon(pos=(0., 0.), radius=0.4, sides=8,
- color=(0, 0, 1, 1))
- rpolygon.transform = transforms.STTransform(scale=(75, 100),
- translate=(50, 50))
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot", 'visuals/regular_polygon4.png')
-
- rpolygon = visuals.RegularPolygon(pos=(0., 0.), radius=0.4, sides=8,
- color=(0, 0, 1, 1),
- border_color=(1, 0, 0, 1))
- rpolygon.transform = transforms.STTransform(scale=(75, 100),
- translate=(50, 50))
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot", 'visuals/regular_polygon5.png')
-
- rpolygon = visuals.RegularPolygon(pos=(0., 0.), radius=0.4, sides=8,
- border_color=(1, 0, 0, 1))
- rpolygon.transform = transforms.STTransform(scale=(75, 100),
- translate=(50, 50))
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot", 'visuals/regular_polygon6.png',
- min_corr=0.6)
-
-
- at requires_application()
-def test_reactive_draw():
- """Test reactive regular polygon attributes"""
- with TestingCanvas() as c:
- rpolygon = visuals.RegularPolygon(pos=[50, 50, 0.], radius=20, sides=8,
- color='yellow')
- c.draw_visual(rpolygon)
-
- rpolygon.pos = [70, 40, 0.]
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_regular_polygon1.png')
-
- rpolygon.radius = 25
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_regular_polygon2.png')
-
- rpolygon.color = 'red'
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_regular_polygon3.png')
-
- rpolygon.border_color = 'yellow'
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_regular_polygon4.png')
-
- rpolygon.sides = 6
- c.draw_visual(rpolygon)
- assert_image_approved("screenshot",
- 'visuals/reactive_regular_polygon5.png')
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_sdf.py b/vispy/visuals/tests/test_sdf.py
deleted file mode 100644
index 8d7c1d2..0000000
--- a/vispy/visuals/tests/test_sdf.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-import numpy as np
-from numpy.testing import assert_allclose
-
-from vispy.app import Canvas
-from vispy.visuals.text._sdf import SDFRenderer
-from vispy import gloo
-from vispy.testing import requires_application, run_tests_if_main
-
-
- at requires_application()
-def test_sdf():
- """Test basic text support - sdf"""
- # test a simple cases
- data = (np.array([[0, 0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0, 0, 0, 0],
- [0, 0, 1, 1, 1, 1, 1, 0, 0],
- [0, 0, 1, 1, 1, 1, 1, 0, 0],
- [0, 0, 1, 1, 1, 1, 1, 0, 0],
- [0, 0, 1, 1, 1, 1, 1, 0, 0]]) * 255).astype(np.uint8)
- expd = (np.array([[8, 5, 4, 4, 4, 4, 4, 5, 8],
- [5, 2, 1, 1, 1, 1, 1, 2, 5],
- [4, 1, 0, 0, 0, 0, 0, 1, 4],
- [4, 1, 0, -1, -4, -1, 0, 1, 4], # XXX artifact
- [4, 1, 0, -1, -4, -1, 0, 1, 4],
- [4, 1, 0, -1, -4, -1, 0, 1, 4]]))
- expd = 0.5 - (np.sqrt(np.abs(expd)) * np.sign(expd)) / 256. * 8
- expd = np.round(256 * expd).astype(np.int)
-
- with Canvas(size=(100, 100)):
- tex = gloo.Texture2D(data.shape + (3,), format='rgb')
- SDFRenderer().render_to_texture(data, tex, (0, 0), data.shape[::-1])
- gloo.set_viewport(0, 0, *data.shape[::-1])
- gloo.util.draw_texture(tex)
- result = gloo.util._screenshot()[:, :, 0].astype(np.int)
- print(result)
- print(expd)
- assert_allclose(result, expd, atol=1)
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_spectrogram.py b/vispy/visuals/tests/test_spectrogram.py
deleted file mode 100644
index 754dc4d..0000000
--- a/vispy/visuals/tests/test_spectrogram.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-import numpy as np
-
-from vispy.scene.visuals import Spectrogram
-from vispy.testing import (requires_application, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_application()
-def test_spectrogram():
- """Test spectrogram visual"""
- n_fft = 256
- n_freqs = n_fft // 2 + 1
- size = (100, n_freqs)
- with TestingCanvas(size=size) as c:
- np.random.seed(67853498)
- data = np.random.normal(size=n_fft * 100)
- spec = Spectrogram(data, n_fft=n_fft, step=n_fft, window=None,
- color_scale='linear', cmap='grays')
- c.draw_visual(spec)
- #expected = np.zeros(size[::-1] + (3,))
- #expected[0] = 1.
- assert_image_approved("screenshot", "visuals/spectrogram.png")
- freqs = spec.freqs
- assert len(freqs) == n_freqs
- assert freqs[0] == 0
- assert freqs[-1] == 0.5
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_text.py b/vispy/visuals/tests/test_text.py
deleted file mode 100644
index c6aba66..0000000
--- a/vispy/visuals/tests/test_text.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-from vispy.scene.visuals import Text
-from vispy.testing import (requires_application, TestingCanvas,
- run_tests_if_main)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_application()
-def test_text():
- """Test basic text support"""
-
- with TestingCanvas(bgcolor='w', size=(92, 92), dpi=92) as c:
- pos = [92 // 2] * 2
- text = Text('testing', font_size=20, color='k',
- pos=pos, anchor_x='center', anchor_y='baseline')
- c.draw_visual(text)
- # Test image created in Illustrator CS5, 1"x1" output @ 92 DPI
- assert_image_approved("screenshot", 'visuals/text1.png')
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/tests/test_volume.py b/vispy/visuals/tests/test_volume.py
deleted file mode 100644
index c30e955..0000000
--- a/vispy/visuals/tests/test_volume.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import numpy as np
-from pytest import raises
-from vispy import scene
-
-from vispy.testing import (TestingCanvas, requires_application,
- run_tests_if_main, requires_pyopengl)
-from vispy.testing.image_tester import assert_image_approved
-
-
- at requires_pyopengl()
-def test_volume():
-
- vol = np.zeros((20, 20, 20), 'float32')
- vol[8:16, 8:16, :] = 1.0
-
- # Create
- V = scene.visuals.Volume(vol)
- assert V.clim == (0, 1)
- assert V.method == 'mip'
-
- # Set wrong data
- with raises(ValueError):
- V.set_data(np.zeros((20, 20), 'float32'))
-
- # Clim
- V.set_data(vol, (0.5, 0.8))
- assert V.clim == (0.5, 0.8)
- with raises(ValueError):
- V.set_data(vol, (0.5, 0.8, 1.0))
-
- # Method
- V.method = 'iso'
- assert V.method == 'iso'
-
- # Step size
- V.relative_step_size = 1.1
- assert V.relative_step_size == 1.1
- # Disallow 0 step size to avoid GPU stalling
- with raises(ValueError):
- V.relative_step_size = 0
-
-
- at requires_pyopengl()
- at requires_application()
-def test_volume_draw():
- with TestingCanvas(bgcolor='k', size=(100, 100)) as c:
- v = c.central_widget.add_view()
- v.camera = 'turntable'
- v.camera.fov = 70
- # Create
- np.random.seed(2376)
- vol = np.random.normal(size=(20, 20, 20), loc=0.5, scale=0.2)
- vol[8:16, 8:16, :] += 1.0
- V = scene.visuals.Volume(vol, parent=v.scene) # noqa
- v.camera.set_range()
- assert_image_approved(c.render(), 'visuals/volume.png')
-
-
-run_tests_if_main()
diff --git a/vispy/visuals/transforms/tests/test_transforms.py b/vispy/visuals/transforms/tests/test_transforms.py
deleted file mode 100644
index 4ae8138..0000000
--- a/vispy/visuals/transforms/tests/test_transforms.py
+++ /dev/null
@@ -1,246 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2015, Vispy Development Team.
-# Distributed under the (new) BSD License. See LICENSE.txt for more info.
-
-import numpy as np
-
-import vispy.visuals.transforms as tr
-from vispy.geometry import Rect
-from vispy.testing import run_tests_if_main
-
-NT = tr.NullTransform
-ST = tr.STTransform
-AT = tr.AffineTransform
-RT = tr.PerspectiveTransform
-PT = tr.PolarTransform
-LT = tr.LogTransform
-CT = tr.ChainTransform
-
-
-def assert_chain_types(chain, types):
- assert list(map(type, chain.transforms)) == types
-
-
-def assert_chain_objects(chain1, chain2):
- assert chain1.transforms == chain2.transforms
-
-
-def tesst_multiplication():
- n = NT()
- s = ST()
- a = AT()
- p = PT()
- l = LT()
- c1 = CT([s, a, p])
- assert c1
- c2 = CT([s, a, s])
-
- assert isinstance(n * n, NT)
- assert isinstance(n * s, ST)
- assert isinstance(s * s, ST)
- assert isinstance(a * s, AT)
- assert isinstance(a * a, AT)
- assert isinstance(s * a, AT)
- assert isinstance(n * p, PT)
- assert isinstance(s * p, CT)
- assert_chain_types(s * p, [PT, ST])
- assert_chain_types(s * p * a, [ST, PT, AT])
- assert_chain_types(s * a * p, [PT, AT])
- assert_chain_types(s * p * s, [ST, PT, ST])
- assert_chain_types(s * a * p * s * a, [AT, PT, AT])
- assert_chain_types(c2 * a, [AT])
- assert_chain_types(p * l * s, [ST, LT, PT])
-
-
-def test_transform_chain():
- # Make dummy classes for easier distinguishing the transforms
-
- class DummyTrans(tr.BaseTransform):
- glsl_map = "vec4 trans(vec4 pos) {return pos;}"
- glsl_imap = "vec4 trans(vec4 pos) {return pos;}"
-
- class TransA(DummyTrans):
- pass
-
- class TransB(DummyTrans):
- pass
-
- class TransC(DummyTrans):
- pass
-
- # Create test transforms
- a, b, c = TransA(), TransB(), TransC()
-
- # Test Chain creation
- assert tr.ChainTransform().transforms == []
- assert tr.ChainTransform(a).transforms == [a]
- assert tr.ChainTransform(a, b).transforms == [a, b]
- assert tr.ChainTransform(a, b, c, a).transforms == [a, b, c, a]
-
- # Test composition by multiplication
- assert_chain_objects(a * b, tr.ChainTransform(a, b))
- assert_chain_objects(a * b * c, tr.ChainTransform(a, b, c))
- assert_chain_objects(a * b * c * a, tr.ChainTransform(a, b, c, a))
-
- # Test adding/prepending to transform
- chain = tr.ChainTransform()
- chain.append(a)
- assert chain.transforms == [a]
- chain.append(b)
- assert chain.transforms == [a, b]
- chain.append(c)
- assert chain.transforms == [a, b, c]
- chain.prepend(b)
- assert chain.transforms == [b, a, b, c]
- chain.prepend(c)
- assert chain.transforms == [c, b, a, b, c]
-
- # Test flattening
- chain1 = tr.ChainTransform(a, b)
- chain2 = tr.ChainTransform(c)
- chain3 = tr.ChainTransform(chain1, chain2)
- chain4 = tr.ChainTransform(a, b, c, chain3)
- chain5 = chain4.flat()
- assert chain5.transforms == [a, b, c, a, b, c]
-
- # Test simplifying
- t1 = tr.STTransform(scale=(2, 3))
- t2 = tr.STTransform(translate=(3, 4))
- t3 = tr.STTransform(translate=(3, 4))
- # Create multiplied versions
- t123 = t1*t2*t3
- t321 = t3*t2*t1
- c123 = tr.ChainTransform(t1, t2, t3)
- c321 = tr.ChainTransform(t3, t2, t1)
- c123s = c123.simplified()
- c321s = c321.simplified()
- #
- assert isinstance(t123, tr.STTransform) # or the test is useless
- assert isinstance(t321, tr.STTransform) # or the test is useless
- assert isinstance(c123s, tr.STTransform) # or the test is useless
- assert isinstance(c321s, tr.STTransform) # or the test is useless
- assert np.all(c123s.scale == t123.scale)
- assert np.all(c123s.translate == t123.translate)
- assert np.all(c321s.scale == t321.scale)
- assert np.all(c321s.translate == t321.translate)
-
- # Test Mapping
- t1 = tr.STTransform(scale=(2, 3))
- t2 = tr.STTransform(translate=(3, 4))
- chain1 = tr.ChainTransform(t1, t2)
- chain2 = tr.ChainTransform(t2, t1)
- #
- assert chain1.transforms == [t1, t2] # or the test is useless
- assert chain2.transforms == [t2, t1] # or the test is useless
- #
- m12 = (t1*t2).map((1, 1)).tolist()
- m21 = (t2*t1).map((1, 1)).tolist()
- m12_ = chain1.map((1, 1)).tolist()
- m21_ = chain2.map((1, 1)).tolist()
- #
- #print(m12, m21, m12_, m21_)
- assert m12 != m21
- assert m12 == m12_
- assert m21 == m21_
-
- # Test shader map
- t1 = tr.STTransform(scale=(2, 3))
- t2 = tr.STTransform(translate=(3, 4))
- chain = tr.ChainTransform(t1, t2)
- #
- funcs = chain.shader_map().dependencies()
- funcsi = chain.shader_imap().dependencies()
- #
- assert t1.shader_map() in funcs
- assert t2.shader_map() in funcs
- assert t1.shader_imap() in funcsi
- assert t2.shader_imap() in funcsi
-
-
-def test_map_rect():
- r = Rect((2, 7), (13, 19))
- r1 = ST(scale=(2, 2), translate=(-10, 10)).map(r)
- assert r1 == Rect((-6, 24), (26, 38))
-
-
-def test_st_transform():
- # Check that STTransform maps exactly like AffineTransform
- pts = np.random.normal(size=(10, 4))
-
- scale = (1, 7.5, -4e-8)
- translate = (1e6, 0.2, 0)
- st = tr.STTransform(scale=scale, translate=translate)
- at = tr.AffineTransform()
- at.scale(scale)
- at.translate(translate)
-
- assert np.allclose(st.map(pts), at.map(pts))
- assert np.allclose(st.inverse.map(pts), at.inverse.map(pts))
-
-
-def test_st_mapping():
- p1 = [[5., 7.], [23., 8.]]
- p2 = [[-1.3, -1.4], [1.1, 1.2]]
-
- t = tr.STTransform()
- t.set_mapping(p1, p2)
-
- assert np.allclose(t.map(p1)[:, :len(p2)], p2)
-
-
-def test_affine_mapping():
- t = tr.AffineTransform()
- p1 = np.array([[0, 0, 0],
- [1, 0, 0],
- [0, 1, 0],
- [0, 0, 1]])
-
- # test pure translation
- p2 = p1 + 5.5
- t.set_mapping(p1, p2)
- assert np.allclose(t.map(p1)[:, :p2.shape[1]], p2)
-
- # test pure scaling
- p2 = p1 * 5.5
- t.set_mapping(p1, p2)
- assert np.allclose(t.map(p1)[:, :p2.shape[1]], p2)
-
- # test scale + translate
- p2 = (p1 * 5.5) + 3.5
- t.set_mapping(p1, p2)
- assert np.allclose(t.map(p1)[:, :p2.shape[1]], p2)
-
- # test SRT
- p2 = np.array([[10, 5, 3],
- [10, 15, 3],
- [30, 5, 3],
- [10, 5, 3.5]])
- t.set_mapping(p1, p2)
- assert np.allclose(t.map(p1)[:, :p2.shape[1]], p2)
-
-
-def test_inverse():
- m = np.random.normal(size=(4, 4))
- transforms = [
- NT(),
- ST(scale=(1e-4, 2e5), translate=(10, -6e9)),
- AT(m),
- RT(m),
- ]
-
- np.random.seed(0)
- N = 20
- x = np.random.normal(size=(N, 3))
- pw = np.random.normal(size=(N, 3), scale=3)
- pos = x * 10 ** pw
-
- for trn in transforms:
- assert np.allclose(pos, trn.inverse.map(trn.map(pos))[:, :3])
-
- # log transform only works on positive values
- #abs_pos = np.abs(pos)
- #tr = LT(base=(2, 4.5, 0))
- #assert np.allclose(abs_pos, tr.inverse.map(tr.map(abs_pos))[:,:3])
-
-
-run_tests_if_main()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/vispy.git
More information about the debian-science-commits
mailing list