code: def test_read_pixels():
      """Test read_pixels to ensure that the image is not flipped"""
      # Create vertices
      vPosition = np.array(
          [
              [-1, 1, 0.0],
              [0, 1, 0.5],  # For drawing a square to top left
              [-1, 0, 0.0],
              [0, 0, 0.5],
          ],
          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
      void main()
      {
          gl_FragColor = vec4(1,1,1,1);
      }
      """
  
      with Canvas() as c:
          c.set_current()
          gloo.set_viewport(0, 0, *c.size)
          gloo.set_state(depth_test=True)
          c._program = gloo.Program(VERT_SHADER, FRAG_SHADER)
          c._program["a_position"] = gloo.VertexBuffer(vPosition)
          gloo.clear(color="black")
          c._program.draw("triangle_strip")
  
          # Check if the return of read_pixels is the same as our drawing
          img = read_pixels(alpha=False)
          assert_equal(img.shape[:2], c.size[::-1])
          top_left = sum(img[0, 0])
          assert_true(top_left > 0)  # Should be > 0 (255*4)
          # Sum of the pixels in top right + bottom left + bottom right corners
          corners = sum(img[0, -1] + img[-1, 0] + img[-1, -1])
          assert_true(corners == 0)  # Should be all 0
          gloo.flush()
          gloo.finish()
  
          # Check that we can read the depth buffer
          img = read_pixels(mode="depth")
          assert_equal(img.shape[:2], c.size[::-1])
          assert_equal(img.shape[2], 1)
          unique_img = np.unique(img)
          # we should have quite a few different depth values
          assert unique_img.shape[0] > 50
          assert unique_img.max() == 255
          assert unique_img.min() > 0
  
file_path: vispy/vispy/gloo/tests/test_wrappers.py
imports: import numpy
  from numpy.testing import assert_array_equal, assert_allclose
  from vispy import gloo
  from vispy.gloo import gl
  from vispy.app import Canvas
  from vispy.testing import requires_application, run_tests_if_main, assert_true, assert_equal, assert_raises
  from vispy.gloo import read_pixels
  from vispy.gloo.glir import GlirQueue
  from vispy.gloo import wrappers
label_desc: Use image node_id 8 for calling a global function with example usage: test_read_pixels() without return types