.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/validation/validate_image1.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__gallery_validation_validate_image1.py: Image on Plane Geometry 1 ========================= Show an image using a plane geometry. For historic reasons, image data (usually) has the first rows representing the top of the image. But the plane gemeometry is such that it is reversed again. * The green dots should be at the corners that are NOT darker/brighter. * The green dots should be on the edge of the image. * The darker corner is in the top left. .. GENERATED FROM PYTHON SOURCE LINES 13-59 .. image-sg:: /_gallery/validation/images/sphx_glr_validate_image1_001.webp :alt: validate image1 :srcset: /_gallery/validation/images/sphx_glr_validate_image1_001.webp :class: sphx-glr-single-img .. code-block:: Python import numpy as np from rendercanvas.auto import RenderCanvas, loop import pygfx as gfx canvas = RenderCanvas() renderer = gfx.renderers.WgpuRenderer(canvas) scene = gfx.Scene() im = ( np.array( [ [0, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 2], ], np.float32, ) / 2.0 ) tex = gfx.Texture(im, dim=2) plane = gfx.Mesh( gfx.plane_geometry(4, 4), gfx.MeshBasicMaterial(map=gfx.TextureMap(tex, filter="nearest")), ) plane.local.position = (2, 2, 0) # put corner at 0, 0 scene.add(plane) points = gfx.Points( gfx.Geometry(positions=[[0, 0, 1], [4, 4, 1]]), gfx.PointsMaterial(color=(0, 1, 0, 1), size=20, aa=True), ) scene.add(points) camera = gfx.OrthographicCamera(10, 10) canvas.request_draw(lambda: renderer.render(scene, camera)) if __name__ == "__main__": print(__doc__) loop.run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.141 seconds) .. _sphx_glr_download__gallery_validation_validate_image1.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: validate_image1.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: validate_image1.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: validate_image1.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_ .. only:: html Interactive example ------------------- Try this example in your browser using Pyodide. Might not work with all examples and all devices. Check the output and your browser's console for details. .. raw:: html