forked frommarcan/blitzloop
- Notifications
You must be signed in to change notification settings - Fork0
Expand file tree
/
Copy pathgraphics.py
More file actions
69 lines (60 loc) · 2.22 KB
/
graphics.py
File metadata and controls
69 lines (60 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2017 Hector Martin "marcan" <hector@marcansoft.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 or version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
fromblitzloopimportutil
defDisplay(*args,**kwargs):
global_display
display=util.get_opts().display
ifdisplay=="glut":
fromblitzloop.backendimportglut
_display=glut.Display(*args,**kwargs)
elifdisplay=="glfw":
fromblitzloop.backendimportglfw
_display=glfw.Display(*args,**kwargs)
elifdisplay=="rpi":
fromblitzloop.backendimportrpi
_display=rpi.Display(*args,**kwargs)
elifdisplay=="kms":
fromblitzloop.backendimportkms
_display=kms.Display(*args,**kwargs)
elifdisplay=="surfaceless":
fromblitzloop.backendimportsurfaceless
_display=surfaceless.Display(*args,**kwargs)
else:
raiseException("Unknown display: %s"%display)
return_display
_renderer=None
defget_renderer():
global_renderer
if_rendererisNone:
fromblitzloop.rendererimportglesas_renderer
return_renderer
_solid_renderer=None
defget_solid_renderer():
global_solid_renderer
if_solid_rendererisNone:
_solid_renderer=get_renderer().SolidRenderer(_display)
return_solid_renderer
_texture_renderer=None
defget_texture_renderer():
global_texture_renderer
if_texture_rendererisNone:
_texture_renderer=get_renderer().TextureRenderer(_display)
return_texture_renderer
defGL():
returnget_renderer().gl
defarrays():
returnget_renderer().arrays