@requires_application()
def test_context_sharing():
 with Canvas() as c1:
  vert = 'attribute vec4 pos;\nvoid main (void) {gl_Position = pos;}'
  frag = 'void main (void) {gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);}'
  program = Program(vert, frag)
  program['pos'] = [(1, 2, 3, 1), (4, 5, 6, 1)]
  program.draw('points')
  def check():
   program['pos'] = [(1, 2, 3, 1), (4, 5, 6, 1)]
   program.draw('points')
   check_error()
  check()
  with Canvas() as c2:
   if ('pyglet' not in c2.app.backend_name.lower()):
    assert_raises(Exception, check)
  with Canvas(shared=c1.context) as c2:
   assert (c1.context.shared is c2.context.shared)
   check()

@ requires_application ( ) def test_context_sharing ( ) : with Canvas ( ) as c1 : vert = 'attribute vec4 pos;\nvoid main (void) {gl_Position = pos;}' frag = 'void main (void) {gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);}' program = Program ( vert , frag ) program [ 'pos' ] = [ ( 1 , 2 , 3 , 1 ) , ( 4 , 5 , 6 , 1 ) ] program . draw ( 'points' ) def check ( ) : program [ 'pos' ] = [ ( 1 , 2 , 3 , 1 ) , ( 4 , 5 , 6 , 1 ) ] program . draw ( 'points' ) check_error ( ) check ( ) with Canvas ( ) as c2 : if ( 'pyglet' not in c2 . app . backend_name . lower ( ) ) : assert_raises ( Exception , check ) with Canvas ( shared = c1 . context ) as c2 : assert ( c1 . context . shared is c2 . context . shared ) check ( )
test context sharing .