-
Notifications
You must be signed in to change notification settings - Fork 9
/
renderer.diff
49 lines (46 loc) · 2.07 KB
/
renderer.diff
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
--- renderer_original.py Mon Jun 24 16:48:40 2019
+++ renderer.py Mon Jun 24 16:40:27 2019
@@ -324,7 +324,8 @@
# Clear it
glClearColor(*scene.bg_color)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
- glEnable(GL_MULTISAMPLE)
+ if not (flags & RenderFlags.DISABLE_MULTISAMPLING):
+ glEnable(GL_MULTISAMPLE)
# Set up camera matrices
V, P = self._get_camera_matrices(scene)
@@ -972,7 +973,7 @@
# If using offscreen render, bind main framebuffer
if flags & RenderFlags.OFFSCREEN:
- self._configure_main_framebuffer()
+ self._configure_main_framebuffer(flags)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, self._main_fb_ms)
else:
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0)
@@ -1014,7 +1015,7 @@
if self._shadow_fb is not None:
glDeleteFramebuffers(1, [self._shadow_fb])
- def _configure_main_framebuffer(self):
+ def _configure_main_framebuffer(self, flags):
# If mismatch with prior framebuffer, delete it
if (self._main_fb is not None and
self.viewport_width != self._main_fb_dims[0] or
@@ -1052,10 +1053,14 @@
# Generate multisample buffer
self._main_cb_ms, self._main_db_ms = glGenRenderbuffers(2)
glBindRenderbuffer(GL_RENDERBUFFER, self._main_cb_ms)
- glRenderbufferStorageMultisample(
- GL_RENDERBUFFER, 4, GL_RGBA,
- self.viewport_width, self.viewport_height
- )
+ if not (flags & RenderFlags.DISABLE_MULTISAMPLING):
+ glRenderbufferStorageMultisample(
+ GL_RENDERBUFFER, 4, GL_RGBA,
+ self.viewport_width, self.viewport_height
+ )
+ else:
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, self.viewport_width, self.viewport_height)
+
glBindRenderbuffer(GL_RENDERBUFFER, self._main_db_ms)
glRenderbufferStorageMultisample(
GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT24,