:orphan:

Gloo
====

More example scripts are available in the VisPy repository's
`example scripts directory <https://github.com/vispy/vispy/tree/main/examples>`_.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Draw a new array of random image pixels on every draw cycle.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_animate_images_thumb.gif
    :alt:

  :ref:`sphx_glr_gallery_gloo_animate_images.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show an Image</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Use a timer to trigger updating an image.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_animate_images_slice_thumb.gif
    :alt:

  :ref:`sphx_glr_gallery_gloo_animate_images_slice.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Animate an Image</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Example demonstrating showing a quad using a Texture2D and VertexBuffer and a timer to control the drawing.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_animate_shape_thumb.gif
    :alt:

  :ref:`sphx_glr_gallery_gloo_animate_shape.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Animate a Shape</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Show a rotating colored cube">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_colored_cube_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_colored_cube.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show a rotating colored cube</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Draw many colored cubes using instanced rendering">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_colored_cube_instanced_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_colored_cube_instanced.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw many colored cubes using instanced rendering</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Create a new drawing using triangle_strip">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_colored_quad_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_colored_quad.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show color quad Image</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates how multiple line-pieces can be drawn using one call, by discarding some fragments.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_display_lines_thumb.gif
    :alt:

  :ref:`sphx_glr_gallery_gloo_display_lines.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw a bunch of lines</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple example plotting 2D points.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_display_points_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_display_points.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw 2D points</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simple example demonstrating showing a quad using a gloo Program.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_display_shape_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_display_shape.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw a Quad</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Minimal example demonstrating the use of frame buffer objects (FBO). This example blurs the output image.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_hello_fbo_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_hello_fbo.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Use FrameBuffers</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Show a rotating cube with lighting">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_lighted_cube_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_lighted_cube.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show a rotating cube with lighting</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="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.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_multi_texture_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_multi_texture.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Use multiple textures</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Show a rotating cube with an outline">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_outlined_cube_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_outlined_cube.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show a rotating cube with an outline</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Show post-processing using a FrameBuffer">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_post_processing_thumb.gif
    :alt:

  :ref:`sphx_glr_gallery_gloo_post_processing.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show post-processing using a FrameBuffer</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example shows how to display 3D objects.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_rotate_cube_thumb.gif
    :alt:

  :ref:`sphx_glr_gallery_gloo_rotate_cube.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Draw 3D rotating Cube</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Use a Timer to animate a quad">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_rotating_quad_thumb.gif
    :alt:

  :ref:`sphx_glr_gallery_gloo_rotating_quad.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Rotating Quad</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Example demonstrating spatial filtering using spatial-filters fragment shader.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_spatial_filters_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_spatial_filters.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Spatial Filtering</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simplest Possible Script">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_start_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_start.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Simplest Possible Script</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Simplest Shader Program">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_start_shaders_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_start_shaders.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Simplest Shader Program</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="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.">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_texture_precision_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_texture_precision.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Example using texture internalformat for higher precision</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Show a rotating textured cube">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_textured_cube_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_textured_cube.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show a rotating textured cube</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Show a textured quad">

.. only:: html

  .. image:: /gallery/gloo/images/thumb/sphx_glr_textured_quad_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_textured_quad.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Show a textured quad</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:

   /gallery/gloo/animate_images
   /gallery/gloo/animate_images_slice
   /gallery/gloo/animate_shape
   /gallery/gloo/colored_cube
   /gallery/gloo/colored_cube_instanced
   /gallery/gloo/colored_quad
   /gallery/gloo/display_lines
   /gallery/gloo/display_points
   /gallery/gloo/display_shape
   /gallery/gloo/hello_fbo
   /gallery/gloo/lighted_cube
   /gallery/gloo/multi_texture
   /gallery/gloo/outlined_cube
   /gallery/gloo/post_processing
   /gallery/gloo/rotate_cube
   /gallery/gloo/rotating_quad
   /gallery/gloo/spatial_filters
   /gallery/gloo/start
   /gallery/gloo/start_shaders
   /gallery/gloo/texture_precision
   /gallery/gloo/textured_cube
   /gallery/gloo/textured_quad

The low-level GL module
=======================

Vispy has a low-level `gl` module which wraps `GL` calls almost to a 1-to-1 ratio. While this is intended mostly for internal use, it is possible to use this to construct programs.



.. raw:: html

    <div class="sphx-glr-thumbnails">

.. thumbnail-parent-div-open

.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Drawing a rotated 3D cube">

.. only:: html

  .. image:: /gallery/gloo/gl/images/thumb/sphx_glr_cube_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_gl_cube.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Drawing a rotated 3D cube</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="(adapted from the &quot;OpenGL ES 2.0 Programming Guide&quot;) 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.">

.. only:: html

  .. image:: /gallery/gloo/gl/images/thumb/sphx_glr_fireworks_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_gl_fireworks.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Example demonstrating simulation of fireworks using point sprites</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="Drawing a simple quad">

.. only:: html

  .. image:: /gallery/gloo/gl/images/thumb/sphx_glr_quad_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_gl_quad.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Drawing a simple quad</div>
    </div>


.. raw:: html

    <div class="sphx-glr-thumbcontainer" tooltip="This example is a modification of examples/tutorial/gl/quad.py which uses instanced rendering to generate many copies of the same quad.">

.. only:: html

  .. image:: /gallery/gloo/gl/images/thumb/sphx_glr_quad_instanced_thumb.png
    :alt:

  :ref:`sphx_glr_gallery_gloo_gl_quad_instanced.py`

.. raw:: html

      <div class="sphx-glr-thumbnail-title">Displaying quads using Instanced rendering</div>
    </div>


.. thumbnail-parent-div-close

.. raw:: html

    </div>


.. toctree::
   :hidden:
   :includehidden:


   /gallery/gloo/gl/index.rst


.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-gallery

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download all examples in Python source code: gloo_python.zip </gallery/gloo/gloo_python.zip>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download all examples in Jupyter notebooks: gloo_jupyter.zip </gallery/gloo/gloo_jupyter.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
