meltygui-imgui 2.0.0.post3__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meltygui_imgui/__init__.py +879 -0
- meltygui_imgui/_compat.py +16 -0
- meltygui_imgui/ansifeed.pxd +20 -0
- meltygui_imgui/cimgui.pxd +2242 -0
- meltygui_imgui/common.pyx +75 -0
- meltygui_imgui/core.cp313-win_amd64.pyd +0 -0
- meltygui_imgui/core.cpp +189914 -0
- meltygui_imgui/core.h +51 -0
- meltygui_imgui/core.pxd +12 -0
- meltygui_imgui/core.pyx +12812 -0
- meltygui_imgui/enums.pxd +561 -0
- meltygui_imgui/enums_internal.pxd +200 -0
- meltygui_imgui/extra.py +36 -0
- meltygui_imgui/integrations/__init__.py +13 -0
- meltygui_imgui/integrations/base.py +33 -0
- meltygui_imgui/integrations/cocos2d.py +27 -0
- meltygui_imgui/integrations/glfw.py +133 -0
- meltygui_imgui/integrations/glumpy.py +369 -0
- meltygui_imgui/integrations/opengl.py +422 -0
- meltygui_imgui/integrations/pygame.py +152 -0
- meltygui_imgui/integrations/pyglet.py +245 -0
- meltygui_imgui/integrations/sdl2.py +136 -0
- meltygui_imgui/internal.cp313-win_amd64.pyd +0 -0
- meltygui_imgui/internal.cpp +13336 -0
- meltygui_imgui/internal.h +51 -0
- meltygui_imgui/internal.pxd +686 -0
- meltygui_imgui/internal.pyx +207 -0
- meltygui_imgui-2.0.0.post3.dist-info/DELVEWHEEL +2 -0
- meltygui_imgui-2.0.0.post3.dist-info/METADATA +146 -0
- meltygui_imgui-2.0.0.post3.dist-info/RECORD +38 -0
- meltygui_imgui-2.0.0.post3.dist-info/WHEEL +5 -0
- meltygui_imgui-2.0.0.post3.dist-info/licenses/LICENSE +28 -0
- meltygui_imgui-2.0.0.post3.dist-info/licenses/LICENSES/imgui-MIT.txt +21 -0
- meltygui_imgui-2.0.0.post3.dist-info/licenses/LICENSES/imstb_rectpack.h.license.txt +37 -0
- meltygui_imgui-2.0.0.post3.dist-info/licenses/LICENSES/imstb_textedit.h.license.txt +37 -0
- meltygui_imgui-2.0.0.post3.dist-info/licenses/LICENSES/imstb_truetype.h.license.txt +37 -0
- meltygui_imgui-2.0.0.post3.dist-info/top_level.txt +1 -0
- meltygui_imgui.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
import ctypes
|
|
5
|
+
from ctypes import *
|
|
6
|
+
import meltygui_imgui
|
|
7
|
+
from meltygui_imgui.integrations.opengl import BaseOpenGLRenderer
|
|
8
|
+
|
|
9
|
+
from glumpy import gloo, gl
|
|
10
|
+
|
|
11
|
+
from matplotlib import pyplot as plt
|
|
12
|
+
|
|
13
|
+
from glumpy.log import log
|
|
14
|
+
|
|
15
|
+
import glfw
|
|
16
|
+
|
|
17
|
+
from meltygui_imgui.integrations import compute_fb_scale
|
|
18
|
+
|
|
19
|
+
class GlumpyRenderer(BaseOpenGLRenderer):
|
|
20
|
+
|
|
21
|
+
"""GLumpy backend for pyimgui. The code borrows heavily from the glfw integration. """
|
|
22
|
+
|
|
23
|
+
VERTEX_SHADER_SRC = """
|
|
24
|
+
#version 330
|
|
25
|
+
uniform mat4 ProjMtx;
|
|
26
|
+
in vec2 Position;
|
|
27
|
+
in vec2 UV;
|
|
28
|
+
in vec4 Color;
|
|
29
|
+
out vec2 Frag_UV;
|
|
30
|
+
out vec4 Frag_Color;
|
|
31
|
+
void main() {
|
|
32
|
+
Frag_UV = UV;
|
|
33
|
+
Frag_Color = Color;
|
|
34
|
+
gl_Position = ProjMtx * vec4(Position.xy, 0, 1);
|
|
35
|
+
}
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
FRAGMENT_SHADER_SRC = """
|
|
39
|
+
#version 330
|
|
40
|
+
uniform sampler2D Texture;
|
|
41
|
+
in vec2 Frag_UV;
|
|
42
|
+
in vec4 Frag_Color;
|
|
43
|
+
out vec4 Out_Color;
|
|
44
|
+
void main() {
|
|
45
|
+
vec4 col = Frag_Color; //original
|
|
46
|
+
Out_Color = col * texture(Texture, Frag_UV.st); //original
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
io = None;
|
|
52
|
+
prog : gloo.Program = None;
|
|
53
|
+
|
|
54
|
+
def __init__(self, window, attach_callbacks=True ):
|
|
55
|
+
|
|
56
|
+
#self.io is initialized by super-class
|
|
57
|
+
super(GlumpyRenderer, self).__init__();
|
|
58
|
+
|
|
59
|
+
self.window = window
|
|
60
|
+
|
|
61
|
+
if attach_callbacks:
|
|
62
|
+
glfw.set_key_callback(self.window, self.keyboard_callback)
|
|
63
|
+
glfw.set_cursor_pos_callback(self.window, self.mouse_callback)
|
|
64
|
+
glfw.set_window_size_callback(self.window, self.resize_callback)
|
|
65
|
+
glfw.set_char_callback(self.window, self.char_callback)
|
|
66
|
+
glfw.set_scroll_callback(self.window, self.scroll_callback)
|
|
67
|
+
|
|
68
|
+
self.io.display_size = glfw.get_framebuffer_size(self.window)
|
|
69
|
+
#self.io.get_clipboard_text_fn = self._get_clipboard_text
|
|
70
|
+
#self.io.set_clipboard_text_fn = self._set_clipboard_text
|
|
71
|
+
|
|
72
|
+
self._map_keys()
|
|
73
|
+
self._gui_time = None
|
|
74
|
+
|
|
75
|
+
def _get_clipboard_text(self):
|
|
76
|
+
return glfw.get_clipboard_string(self.window)
|
|
77
|
+
|
|
78
|
+
def _set_clipboard_text(self, text):
|
|
79
|
+
glfw.set_clipboard_string(self.window, text)
|
|
80
|
+
|
|
81
|
+
def _map_keys(self):
|
|
82
|
+
key_map = self.io.key_map
|
|
83
|
+
|
|
84
|
+
key_map[meltygui_imgui.KEY_TAB] = glfw.KEY_TAB
|
|
85
|
+
key_map[meltygui_imgui.KEY_LEFT_ARROW] = glfw.KEY_LEFT
|
|
86
|
+
key_map[meltygui_imgui.KEY_RIGHT_ARROW] = glfw.KEY_RIGHT
|
|
87
|
+
key_map[meltygui_imgui.KEY_UP_ARROW] = glfw.KEY_UP
|
|
88
|
+
key_map[meltygui_imgui.KEY_DOWN_ARROW] = glfw.KEY_DOWN
|
|
89
|
+
key_map[meltygui_imgui.KEY_PAGE_UP] = glfw.KEY_PAGE_UP
|
|
90
|
+
key_map[meltygui_imgui.KEY_PAGE_DOWN] = glfw.KEY_PAGE_DOWN
|
|
91
|
+
key_map[meltygui_imgui.KEY_HOME] = glfw.KEY_HOME
|
|
92
|
+
key_map[meltygui_imgui.KEY_END] = glfw.KEY_END
|
|
93
|
+
key_map[meltygui_imgui.KEY_INSERT] = glfw.KEY_INSERT
|
|
94
|
+
key_map[meltygui_imgui.KEY_DELETE] = glfw.KEY_DELETE
|
|
95
|
+
key_map[meltygui_imgui.KEY_BACKSPACE] = glfw.KEY_BACKSPACE
|
|
96
|
+
key_map[meltygui_imgui.KEY_SPACE] = glfw.KEY_SPACE
|
|
97
|
+
key_map[meltygui_imgui.KEY_ENTER] = glfw.KEY_ENTER
|
|
98
|
+
key_map[meltygui_imgui.KEY_ESCAPE] = glfw.KEY_ESCAPE
|
|
99
|
+
key_map[meltygui_imgui.KEY_PAD_ENTER] = glfw.KEY_KP_ENTER
|
|
100
|
+
key_map[meltygui_imgui.KEY_A] = glfw.KEY_A
|
|
101
|
+
key_map[meltygui_imgui.KEY_C] = glfw.KEY_C
|
|
102
|
+
key_map[meltygui_imgui.KEY_V] = glfw.KEY_V
|
|
103
|
+
key_map[meltygui_imgui.KEY_X] = glfw.KEY_X
|
|
104
|
+
key_map[meltygui_imgui.KEY_Y] = glfw.KEY_Y
|
|
105
|
+
key_map[meltygui_imgui.KEY_Z] = glfw.KEY_Z
|
|
106
|
+
|
|
107
|
+
def keyboard_callback(self, window, key, scancode, action, mods):
|
|
108
|
+
# perf: local for faster access
|
|
109
|
+
io = self.io
|
|
110
|
+
|
|
111
|
+
if action == glfw.PRESS:
|
|
112
|
+
io.keys_down[key] = True
|
|
113
|
+
elif action == glfw.RELEASE:
|
|
114
|
+
io.keys_down[key] = False
|
|
115
|
+
|
|
116
|
+
io.key_ctrl = (
|
|
117
|
+
io.keys_down[glfw.KEY_LEFT_CONTROL] or
|
|
118
|
+
io.keys_down[glfw.KEY_RIGHT_CONTROL]
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
io.key_alt = (
|
|
122
|
+
io.keys_down[glfw.KEY_LEFT_ALT] or
|
|
123
|
+
io.keys_down[glfw.KEY_RIGHT_ALT]
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
io.key_shift = (
|
|
127
|
+
io.keys_down[glfw.KEY_LEFT_SHIFT] or
|
|
128
|
+
io.keys_down[glfw.KEY_RIGHT_SHIFT]
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
io.key_super = (
|
|
132
|
+
io.keys_down[glfw.KEY_LEFT_SUPER] or
|
|
133
|
+
io.keys_down[glfw.KEY_RIGHT_SUPER]
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
def char_callback(self, window, char):
|
|
137
|
+
io = meltygui_imgui.get_io()
|
|
138
|
+
|
|
139
|
+
if 0 < char < 0x10000:
|
|
140
|
+
io.add_input_character(char)
|
|
141
|
+
|
|
142
|
+
def resize_callback(self, window, width, height):
|
|
143
|
+
self.io.display_size = width, height
|
|
144
|
+
|
|
145
|
+
def mouse_callback(self, *args, **kwargs):
|
|
146
|
+
pass
|
|
147
|
+
|
|
148
|
+
def scroll_callback(self, window, x_offset, y_offset):
|
|
149
|
+
self.io.mouse_wheel_horizontal = x_offset
|
|
150
|
+
self.io.mouse_wheel = y_offset
|
|
151
|
+
|
|
152
|
+
def process_inputs(self):
|
|
153
|
+
io = meltygui_imgui.get_io()
|
|
154
|
+
|
|
155
|
+
window_size = glfw.get_window_size(self.window)
|
|
156
|
+
fb_size = glfw.get_framebuffer_size(self.window)
|
|
157
|
+
|
|
158
|
+
io.display_size = window_size
|
|
159
|
+
io.display_fb_scale = compute_fb_scale(window_size, fb_size)
|
|
160
|
+
io.delta_time = 1.0/60
|
|
161
|
+
|
|
162
|
+
if glfw.get_window_attrib(self.window, glfw.FOCUSED):
|
|
163
|
+
io.mouse_pos = glfw.get_cursor_pos(self.window)
|
|
164
|
+
else:
|
|
165
|
+
io.mouse_pos = -1, -1
|
|
166
|
+
|
|
167
|
+
io.mouse_down[0] = glfw.get_mouse_button(self.window, 0)
|
|
168
|
+
io.mouse_down[1] = glfw.get_mouse_button(self.window, 1)
|
|
169
|
+
io.mouse_down[2] = glfw.get_mouse_button(self.window, 2)
|
|
170
|
+
|
|
171
|
+
current_time = glfw.get_time()
|
|
172
|
+
|
|
173
|
+
if self._gui_time:
|
|
174
|
+
io.delta_time = current_time - self._gui_time
|
|
175
|
+
else:
|
|
176
|
+
io.delta_time = 1. / 60.
|
|
177
|
+
if(io.delta_time <= 0.0): io.delta_time = 1./ 1000.
|
|
178
|
+
|
|
179
|
+
self._gui_time = current_time
|
|
180
|
+
|
|
181
|
+
#called first by super-class constructor after self.io is filled
|
|
182
|
+
def _create_device_objects(self):
|
|
183
|
+
self.prog = gloo.Program( self.VERTEX_SHADER_SRC, self.FRAGMENT_SHADER_SRC, version=330 );
|
|
184
|
+
|
|
185
|
+
if False:
|
|
186
|
+
dtype = [('Color', np.float32, 4),
|
|
187
|
+
('Position', np.float32, 2),
|
|
188
|
+
('UV', np.float32, 2)];
|
|
189
|
+
v_array = np.zeros(4, dtype).view(gloo.VertexArray)
|
|
190
|
+
# Four colors
|
|
191
|
+
v_array['Color'] = [ (1,0,0,1), (0,1,0,1), (0,0,1,1), (0,0,0,1) ]
|
|
192
|
+
v_array['Position'] = [ (-1,-1), (-1,+1), (+1,-1), (+1,+1) ]
|
|
193
|
+
v_array['UV'] = [ (0,1), (0,0), (1,1), (1,0) ]
|
|
194
|
+
|
|
195
|
+
self.prog.bind( v_array );
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
unitmat = np.eye( 4, dtype=np.float32 );
|
|
199
|
+
self.prog['ProjMtx'] = unitmat;
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
#called second by super-class constructor
|
|
203
|
+
def refresh_font_texture(self):
|
|
204
|
+
|
|
205
|
+
self.io.fonts.add_font_default()
|
|
206
|
+
width, height, pixels = self.io.fonts.get_tex_data_as_rgba32();
|
|
207
|
+
|
|
208
|
+
tex = np.frombuffer( pixels, dtype=np.uint8 ).reshape(height, width,4);
|
|
209
|
+
self.prog['Texture'] = tex;
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def render( self, draw_data ):
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
# perf: local for faster access
|
|
216
|
+
io = self.io
|
|
217
|
+
|
|
218
|
+
display_width, display_height = io.display_size
|
|
219
|
+
fb_width = int(display_width * io.display_fb_scale[0])
|
|
220
|
+
fb_height = int(display_height * io.display_fb_scale[1])
|
|
221
|
+
|
|
222
|
+
if fb_width == 0 or fb_height == 0:
|
|
223
|
+
return
|
|
224
|
+
|
|
225
|
+
draw_data.scale_clip_rects(*io.display_fb_scale)
|
|
226
|
+
|
|
227
|
+
# backup GL state
|
|
228
|
+
# todo: provide cleaner version of this backup-restore code
|
|
229
|
+
last_program = gl.glGetIntegerv(gl.GL_CURRENT_PROGRAM)
|
|
230
|
+
last_texture = gl.glGetIntegerv(gl.GL_TEXTURE_BINDING_2D)
|
|
231
|
+
last_active_texture = gl.glGetIntegerv(gl.GL_ACTIVE_TEXTURE)
|
|
232
|
+
last_array_buffer = gl.glGetIntegerv(gl.GL_ARRAY_BUFFER_BINDING)
|
|
233
|
+
last_element_array_buffer = gl.glGetIntegerv(gl.GL_ELEMENT_ARRAY_BUFFER_BINDING)
|
|
234
|
+
last_vertex_array = gl.glGetIntegerv(gl.GL_VERTEX_ARRAY_BINDING)
|
|
235
|
+
last_blend_src = gl.glGetIntegerv(gl.GL_BLEND_SRC)
|
|
236
|
+
last_blend_dst = gl.glGetIntegerv(gl.GL_BLEND_DST)
|
|
237
|
+
last_blend_equation_rgb = gl. glGetIntegerv(gl.GL_BLEND_EQUATION_RGB)
|
|
238
|
+
last_blend_equation_alpha = gl.glGetIntegerv(gl.GL_BLEND_EQUATION_ALPHA)
|
|
239
|
+
last_viewport = gl.glGetIntegerv(gl.GL_VIEWPORT)
|
|
240
|
+
last_scissor_box = gl.glGetIntegerv(gl.GL_SCISSOR_BOX)
|
|
241
|
+
last_enable_blend = gl.glIsEnabled(gl.GL_BLEND)
|
|
242
|
+
last_enable_cull_face = gl.glIsEnabled(gl.GL_CULL_FACE)
|
|
243
|
+
last_enable_depth_test = gl.glIsEnabled(gl.GL_DEPTH_TEST)
|
|
244
|
+
last_enable_scissor_test = gl.glIsEnabled(gl.GL_SCISSOR_TEST)
|
|
245
|
+
|
|
246
|
+
gl.glEnable(gl.GL_BLEND)
|
|
247
|
+
gl.glBlendEquation(gl.GL_FUNC_ADD)
|
|
248
|
+
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
|
|
249
|
+
gl.glDisable(gl.GL_CULL_FACE)
|
|
250
|
+
gl.glDisable(gl.GL_DEPTH_TEST)
|
|
251
|
+
gl.glEnable(gl.GL_SCISSOR_TEST)
|
|
252
|
+
#gl.glActiveTexture(gl.GL_TEXTURE0)
|
|
253
|
+
|
|
254
|
+
gl.glViewport(0, 0, int(fb_width), int(fb_height))
|
|
255
|
+
|
|
256
|
+
ortho_projection = (ctypes.c_float * 16)(
|
|
257
|
+
2.0/display_width, 0.0, 0.0, 0.0,
|
|
258
|
+
0.0, 2.0/-display_height, 0.0, 0.0,
|
|
259
|
+
0.0, 0.0, -1.0, 0.0,
|
|
260
|
+
-1.0, 1.0, 0.0, 1.0
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
self.prog["ProjMtx"] = ortho_projection;
|
|
264
|
+
|
|
265
|
+
for commands in draw_data.commands_lists:
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
idx_buffer_offset = 0
|
|
269
|
+
|
|
270
|
+
array_type = c_ubyte * commands.vtx_buffer_size * meltygui_imgui.VERTEX_SIZE;
|
|
271
|
+
data_carray = array_type.from_address(commands.vtx_buffer_data)
|
|
272
|
+
|
|
273
|
+
if not ( meltygui_imgui.VERTEX_BUFFER_POS_OFFSET == 0 and \
|
|
274
|
+
meltygui_imgui.VERTEX_BUFFER_UV_OFFSET == 8 and \
|
|
275
|
+
meltygui_imgui.VERTEX_BUFFER_COL_OFFSET == 16 ):
|
|
276
|
+
log.error("GlumpyRenderer.render(): meltygui_imgui vertex buffer layout has changed ! notify the developers ..." );
|
|
277
|
+
|
|
278
|
+
return;
|
|
279
|
+
|
|
280
|
+
#TODO: this is a bit convoluted; Imgui delivers uint8 colors, but glumpy wants float32's
|
|
281
|
+
dtype = [('Position', np.float32, 2),
|
|
282
|
+
('UV', np.float32, 2),
|
|
283
|
+
('Color', np.uint8, 4)];
|
|
284
|
+
vao_content = np.frombuffer( data_carray, dtype=dtype );
|
|
285
|
+
|
|
286
|
+
dtype2 = [('Position', np.float32, 2),
|
|
287
|
+
('UV', np.float32, 2),
|
|
288
|
+
('Color', np.float32, 4)];
|
|
289
|
+
vao_content_f = np.zeros( vao_content.shape, dtype=dtype2 );
|
|
290
|
+
for i,val in enumerate(vao_content):
|
|
291
|
+
vao_content_f[i] = vao_content[i];
|
|
292
|
+
vao_content_f[i]['Color'] /= 255;
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
v_array = vao_content_f.view(gloo.VertexArray)
|
|
296
|
+
self.prog.bind( v_array );
|
|
297
|
+
|
|
298
|
+
if meltygui_imgui.INDEX_SIZE == 1:
|
|
299
|
+
dtype =np.uint8;
|
|
300
|
+
if meltygui_imgui.INDEX_SIZE == 2:
|
|
301
|
+
dtype =np.uint16;
|
|
302
|
+
if meltygui_imgui.INDEX_SIZE == 4:
|
|
303
|
+
dtype =np.uint32;
|
|
304
|
+
|
|
305
|
+
# gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, self._elements_handle)
|
|
306
|
+
# # todo: check this (sizes)
|
|
307
|
+
# gl.glBufferData(gl.GL_ELEMENT_ARRAY_BUFFER, commands.idx_buffer_size * meltygui_imgui.INDEX_SIZE, ctypes.c_void_p(commands.idx_buffer_data), gl.GL_STREAM_DRAW)
|
|
308
|
+
array_type = c_ubyte * commands.idx_buffer_size * meltygui_imgui.INDEX_SIZE;
|
|
309
|
+
data_carray = array_type.from_address(commands.idx_buffer_data);
|
|
310
|
+
idx_content = np.frombuffer( data_carray, dtype=dtype );
|
|
311
|
+
|
|
312
|
+
for command in commands.commands:
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
# TODO: ImGui Images will not work yet, homogenizing texture id
|
|
316
|
+
# allocation by meltygui_imgui/glumpy is likely a larger issue
|
|
317
|
+
#
|
|
318
|
+
#accessing command.texture_id crashes the prog
|
|
319
|
+
#
|
|
320
|
+
#gl.glBindTexture(gl.GL_TEXTURE_2D, command.texture_id )
|
|
321
|
+
|
|
322
|
+
x, y, z, w = command.clip_rect
|
|
323
|
+
gl.glScissor(int(x), int(fb_height - w), int(z - x), int(w - y))
|
|
324
|
+
|
|
325
|
+
idx_array = idx_content[idx_buffer_offset:(idx_buffer_offset+command.elem_count)].view(gloo.IndexBuffer);
|
|
326
|
+
self.prog.draw( mode = gl.GL_TRIANGLES, indices = idx_array );
|
|
327
|
+
|
|
328
|
+
idx_buffer_offset += command.elem_count;
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
# restore modified GL state
|
|
332
|
+
gl.glUseProgram(last_program)
|
|
333
|
+
gl.glActiveTexture(last_active_texture)
|
|
334
|
+
gl.glBindTexture(gl.GL_TEXTURE_2D, last_texture)
|
|
335
|
+
gl.glBindVertexArray(last_vertex_array)
|
|
336
|
+
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, last_array_buffer)
|
|
337
|
+
gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer)
|
|
338
|
+
gl.glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha)
|
|
339
|
+
gl.glBlendFunc(last_blend_src, last_blend_dst)
|
|
340
|
+
|
|
341
|
+
if last_enable_blend:
|
|
342
|
+
gl.glEnable(gl.GL_BLEND)
|
|
343
|
+
else:
|
|
344
|
+
gl.glDisable(gl.GL_BLEND)
|
|
345
|
+
|
|
346
|
+
if last_enable_cull_face:
|
|
347
|
+
gl.glEnable(gl.GL_CULL_FACE)
|
|
348
|
+
else:
|
|
349
|
+
gl.glDisable(gl.GL_CULL_FACE)
|
|
350
|
+
|
|
351
|
+
if last_enable_depth_test:
|
|
352
|
+
gl.glEnable(gl.GL_DEPTH_TEST)
|
|
353
|
+
else:
|
|
354
|
+
gl.glDisable(gl.GL_DEPTH_TEST)
|
|
355
|
+
|
|
356
|
+
if last_enable_scissor_test:
|
|
357
|
+
gl.glEnable(gl.GL_SCISSOR_TEST)
|
|
358
|
+
else:
|
|
359
|
+
gl.glDisable(gl.GL_SCISSOR_TEST)
|
|
360
|
+
|
|
361
|
+
gl.glViewport(last_viewport[0], last_viewport[1], last_viewport[2], last_viewport[3])
|
|
362
|
+
gl.glScissor(last_scissor_box[0], last_scissor_box[1], last_scissor_box[2], last_scissor_box[3])
|
|
363
|
+
|
|
364
|
+
log.debug("----------------------end---------------------------------")
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def _invalidate_device_objects(self):
|
|
368
|
+
pass
|
|
369
|
+
|