Пример #1
0
    def __init__(self, width, height, config = None, share_group = None, **kwds):
        pf = GLConfig._from_args(config, kwds)
        GLContext.__init__(self, share_group, pf, kwds)
        gl_config = pf._gtk_get_config()
        self._gl_config = gl_config
#		if share:
#			gtk_share = share.shared_context._gtk_get_gl_context()
#		else:
#			gtk_share = None
        gtk_share = self._gtk_get_share()
        GtkPixmap.__init__(self, width, height)
        gdk_pixmap = self._gdk_pixmap
        gdkgl.ext(gdk_pixmap)
        self._gl_drawable = gdk_pixmap.set_gl_capability(glconfig = gl_config)
        print "GLPixmap: self._gl_drawable =", self._gl_drawable ###
        self._gl_context = gdkgl.Context(
            self._gl_drawable,
            direct = False,
            share_list = gtk_share,
            render_type = gdkgl.RGBA_TYPE
        )
        print "GLPixmap: self._gl_context =", self._gl_context ###
        ImageBase.__init__(self, **kwds)
        self.with_context(self._init_context)
        print "GLPixmap: initialised context" ###
Пример #2
0
 def __init__(self, config=None, share_group=None, **kwds):
     config = GLConfig._from_args(config, kwds)
     win = ui.CreateWnd()
     win.CreateWindow(None, None, win_style, win_default_rect, win_none, 0)
     dc = win.GetDC()
     hdc = dc.GetSafeHdc()
     GLContext.__init__(self, share_group, config, hdc, 'screen')
     GGLView.__init__(self, _win=win)
     self.set(**kwds)
     self._with_context(hdc, self._init_context)
     win.ReleaseDC(dc)
Пример #3
0
 def __init__(self, config = None, share_group = None, **kwds):
     config = GLConfig._from_args(config, kwds)
     win = ui.CreateWnd()
     win.CreateWindow(None, None, win_style, win_default_rect,
         win_none, 0)
     dc = win.GetDC()
     hdc = dc.GetSafeHdc()
     GLContext.__init__(self, share_group, config, hdc, 'screen')
     GGLView.__init__(self, _win = win, **kwds)
     self._with_context(hdc, self._init_context)
     win.ReleaseDC(dc)
Пример #4
0
	def __init__(self, config = None, share_group = None, **kwds):
		pf = GLConfig._from_args(config, kwds)
		GLContext.__init__(self, share_group, pf, kwds)
		gtk_share = self._gtk_get_share()
		area = gtkgl.DrawingArea(glconfig = self._gl_config, share_list = gtk_share,
			render_type = gdkgl.RGBA_TYPE)
		area.show()
		self._gtk_connect_after(area, "realize", self._gtk_realize_signal)
		self._gtk_connect(area, "expose-event", self._gtk_expose_event_signal)
		GGLView.__init__(self, _gtk_outer = area, _gtk_input = area,
			_gtk_focus = area)
		self.set(**kwds)
Пример #5
0
 def __init__(self, width, height, config = None, share_group = None, **kwds):
     print "GLPixmap:", width, height, kwds ###
     config = GLConfig._from_args(config, kwds)
     image = gdi.Bitmap(width, height)
     self._win_image = image
     graphics = gdi.Graphics.from_image(image)
     self._win_graphics = graphics
     hdc = graphics.GetHDC()
     self._win_hdc = hdc
     GLContext.__init__(self, share_group, config, hdc, 'pixmap')
     self._with_context(hdc, self._init_context)
     print "GLPixmap: done" ###
Пример #6
0
 def __init__(self, config = None, share_group = None, **kwds):
     pf = GLConfig._from_args(config, kwds)
     GLContext.__init__(self, share_group, pf, kwds)
     gtk_share = self._gtk_get_share()
     area = gtkgl.DrawingArea(glconfig = self._gl_config, share_list = gtk_share,
         render_type = gdkgl.RGBA_TYPE)
     area.show()
     self._gtk_connect_after(area, "realize", self._gtk_realize_signal)
     self._gtk_connect(area, "expose-event", self._gtk_expose_event_signal)
     GGLView.__init__(self, _gtk_outer = area, _gtk_input = area,
         _gtk_focus = area)
     self.set(**kwds)
Пример #7
0
 def __init__(self, width, height, config=None, share_group=None, **kwds):
     print("GLPixmap:", width, height, kwds)  ###
     config = GLConfig._from_args(config, kwds)
     image = gdi.Bitmap(width, height)
     self._win_image = image
     graphics = gdi.Graphics.from_image(image)
     self._win_graphics = graphics
     hdc = graphics.GetHDC()
     self._win_hdc = hdc
     GLContext.__init__(self, share_group, config, hdc, 'pixmap')
     self._with_context(hdc, self._init_context)
     print("GLPixmap: done")  ###
Пример #8
0
 def __init__(self, width, height, config = None, share_group = None, **kwds):
     pf = GLConfig._from_args(config, kwds)
     ns_pf = pf._ns_get_pixel_format()
     ns_size = NSSize(width, height)
     ns_cache = NSCachedImageRep.alloc().initWithSize_depth_separate_alpha_(
         ns_size, 0, True, True)
     ns_image = NSImage.alloc().initWithSize_(ns_size)			
     GLContext.__init__(self, share_group = share_group, _ns_pixel_format = ns_pf)
     self._ns_context.setView_(ns_cache.window().contentView())
     self._init_with_ns_image(ns_image, flipped = False)
     self._ns_cache = ns_cache
     self.with_context(self._init_context)
Пример #9
0
 def __init__(self, width, height, config=None, share_group=None, **kwds):
     pf = GLConfig._from_args(config, kwds)
     ns_pf = pf._ns_get_pixel_format()
     ns_size = NSSize(width, height)
     ns_cache = NSCachedImageRep.alloc().initWithSize_depth_separate_alpha_(
         ns_size, 0, True, True)
     ns_image = NSImage.alloc().initWithSize_(ns_size)
     GLContext.__init__(self,
                        share_group=share_group,
                        _ns_pixel_format=ns_pf)
     self._ns_context.setView_(ns_cache.window().contentView())
     self._init_with_ns_image(ns_image, flipped=False)
     self._ns_cache = ns_cache
     self.with_context(self._init_context)
Пример #10
0
 def __init__(self, width, height, config = None, share_group = None, **kwds):
     print "GLPixmap:", width, height, kwds ###
     config = GLConfig._from_args(config, kwds)
     pyhdc = gui.CreateCompatibleDC(0)
     dc = ui.CreateDCFromHandle(pyhdc)
     hdc = dc.GetSafeHdc()
     hbm = gui.CreateCompatibleBitmap(hdc, width, height)
     bm = ui.CreateBitmapFromHandle(hbm)
     dc.SelectObject(bm)
     self._win_dc = dc
     self._win_hbm = hbm
     self._win_bm = bm
     GLContext.__init__(self, share_group, config, hdc, 'pixmap')
     self._with_context(hdc, self._init_context)
     print "GLPixmap: done" ###
Пример #11
0
 def __init__(self, width, height, config=None, share_group=None, **kwds):
     #print "GLPixmap:", width, height, kwds ###
     config = GLConfig._from_args(config, kwds)
     dc0 = win_none.GetDC()
     dc = dc0.CreateCompatibleDC(dc0)
     bm = ui.CreateBitmap()
     bm.CreateCompatibleBitmap(dc0, width, height)
     win_none.ReleaseDC(dc0)
     dc.SelectObject(bm)
     self._win_dc = dc
     self._win_bm = bm
     hdc = dc.GetSafeHdc()
     win_dump_bitmap(bm)  ###
     GLContext.__init__(self, share_group, config, hdc, 'pixmap')
     self._with_context(hdc, self._init_context)
Пример #12
0
 def __init__(self, width, height, config = None, share_group = None, **kwds):
     #print "GLPixmap:", width, height, kwds ###
     config = GLConfig._from_args(config, kwds)
     dc0 = win_none.GetDC()
     dc = dc0.CreateCompatibleDC(dc0)
     bm = ui.CreateBitmap()
     bm.CreateCompatibleBitmap(dc0, width, height)
     win_none.ReleaseDC(dc0)
     dc.SelectObject(bm)
     self._win_dc = dc
     self._win_bm = bm
     hdc = dc.GetSafeHdc()
     win_dump_bitmap(bm) ###
     GLContext.__init__(self, share_group, config, hdc, 'pixmap')
     self._with_context(hdc, self._init_context)
Пример #13
0
 def __init__(self, width, height, config=None, share_group=None, **kwds):
     print "GLPixmap:", width, height, kwds  ###
     config = GLConfig._from_args(config, kwds)
     pyhdc = gui.CreateCompatibleDC(0)
     dc = ui.CreateDCFromHandle(pyhdc)
     hdc = dc.GetSafeHdc()
     hbm = gui.CreateCompatibleBitmap(hdc, width, height)
     bm = ui.CreateBitmapFromHandle(hbm)
     dc.SelectObject(bm)
     self._win_dc = dc
     self._win_hbm = hbm
     self._win_bm = bm
     GLContext.__init__(self, share_group, config, hdc, 'pixmap')
     self._with_context(hdc, self._init_context)
     print "GLPixmap: done"  ###
Пример #14
0
 def __init__(self, config = None, share_group = None, **kwds):
     pf = GLConfig._from_args(config, kwds)
     ns_pf = pf._ns_get_pixel_format()
     width, height = GGLView._default_size
     ns_rect = NSMakeRect(0, 0, width, height)
     ns_view = _PyGUI_NSOpenGLView.alloc().initWithFrame_pixelFormat_(
         ns_rect, ns_pf)
     ns_view.pygui_component = self
     GGLView.__init__(self, _ns_view = ns_view)
     GLContext.__init__(self, share_group = share_group, _ns_pixel_format = ns_pf)
     ns_context = self._ns_context
     ns_view.setOpenGLContext_(ns_context)
     #ns_context.setView_(ns_view) # Docs say this is needed, but
     # prints warning and seems to work without.
     if pf.double_buffer:
         self._ns_flush = ns_context.flushBuffer
     else:
         self._ns_flush = glFlush
     self.set(**kwds)
     self.with_context(self._init_context)
Пример #15
0
 def __init__(self, config=None, share_group=None, **kwds):
     pf = GLConfig._from_args(config, kwds)
     ns_pf = pf._ns_get_pixel_format()
     width, height = GGLView._default_size
     ns_rect = NSMakeRect(0, 0, width, height)
     ns_view = _PyGUI_NSOpenGLView.alloc().initWithFrame_pixelFormat_(
         ns_rect, ns_pf)
     ns_view.pygui_component = self
     GGLView.__init__(self, _ns_view=ns_view)
     GLContext.__init__(self,
                        share_group=share_group,
                        _ns_pixel_format=ns_pf)
     ns_context = self._ns_context
     ns_view.setOpenGLContext_(ns_context)
     #ns_context.setView_(ns_view) # Docs say this is needed, but
     # prints warning and seems to work without.
     if pf.double_buffer:
         self._ns_flush = ns_context.flushBuffer
     else:
         self._ns_flush = glFlush
     self.set(**kwds)
     self.with_context(self._init_context)
Пример #16
0
 def __init__(self, width, height, config=None, share_group=None, **kwds):
     pf = GLConfig._from_args(config, kwds)
     GLContext.__init__(self, share_group, pf, kwds)
     gl_config = pf._gtk_get_config()
     self._gl_config = gl_config
     #		if share:
     #			gtk_share = share.shared_context._gtk_get_gl_context()
     #		else:
     #			gtk_share = None
     gtk_share = self._gtk_get_share()
     GtkPixmap.__init__(self, width, height)
     gdk_pixmap = self._gdk_pixmap
     gdkgl.ext(gdk_pixmap)
     self._gl_drawable = gdk_pixmap.set_gl_capability(glconfig=gl_config)
     print "GLPixmap: self._gl_drawable =", self._gl_drawable  ###
     self._gl_context = gdkgl.Context(self._gl_drawable,
                                      direct=False,
                                      share_list=gtk_share,
                                      render_type=gdkgl.RGBA_TYPE)
     print "GLPixmap: self._gl_context =", self._gl_context  ###
     ImageBase.__init__(self, **kwds)
     self.with_context(self._init_context)
     print "GLPixmap: initialised context"  ###
Пример #17
0
 def destroy(self):
     GLContext.destroy(self)
Пример #18
0
 def destroy(self):
     GLContext.destroy(self)
     GGLView.destroy(self)
Пример #19
0
 def destroy(self):
     GLContext.destroy(self)
     GGLView.destroy(self)
Пример #20
0
 def destroy(self):
     GLContext.destroy(self)