import wx
import pyglet
from pyglet.gl import *
import sys
if sys.platform == 'win32':
from pyglet.window.win32 import _user32
from pyglet.gl import wgl
elif sys.platform.startswith('linux'):
from pyglet.image.codecs.gdkpixbuf2 import gdk
from pyglet.gl import glx
class AbstractCanvas(pyglet.event.EventDispatcher):
def __init__(self, context, config):
# Create context (same as pyglet.window.Window.__init__)
if not config:
platform = pyglet.window.get_platform()
display = platform.get_default_display()
screen = display.get_screens()[0]
for template_config in [
pyglet.gl.Config(double_buffer=True, depth_size=24),
pyglet.gl.Config(double_buffer=True, depth_size=16)]:
try:
config = screen.get_best_config(template_config)
break
except pyglet.window.NoSuchConfigException:
pass
if not config:
raise pyglet.window.NoSuchConfigException(
'No standard config is available.')
if not config.is_complete():
config = screen.get_best_config(config)
if not context:
context = config.create_context(pyglet.gl.current_context)
self._display = display
self._screen = screen
self._config