@@ -10,16 +10,17 @@ class WindowFBO:
1010 """Fake FBO representing default render target"""
1111 def __init__ (self , window ):
1212 self .window = window
13+ self .ctx = context .ctx ()
1314
14- def bind (self ):
15+ def use (self ):
1516 """Sets the viewport back to the buffer size of the screen/window"""
1617 # The expected height with the current viewport width
1718 expected_height = int (self .window .buffer_width / self .window .aspect_ratio )
19+
1820 # How much positive or negative y padding
1921 blank_space = self .window .buffer_height - expected_height
2022
21- GL .glViewport (0 , int (blank_space / 2 ),
22- self .window .buffer_width , expected_height )
23+ self .ctx .viewport = (0 , blank_space // 2 , self .window .buffer_width , expected_height )
2324
2425 def release (self ):
2526 """Dummy release method"""
@@ -115,7 +116,7 @@ def __enter__(self):
115116 Entering context manager.
116117 This will bind the FBO and return itself.
117118 """
118- self .bind ()
119+ self .use ()
119120 return self
120121
121122 def __exit__ (self , exc_type , exc_val , exc_tb ):
@@ -125,7 +126,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
125126 """
126127 self .release ()
127128
128- def bind (self , stack = True ):
129+ def use (self , stack = True ):
129130 """
130131 Bind FBO adding it to the stack.
131132
@@ -169,13 +170,13 @@ def release(self, stack=True):
169170
170171 # Bind the parent FBO
171172 if parent :
172- parent .bind ()
173+ parent .use ()
173174
174175 def clear (self , red = 0.0 , green = 0.0 , blue = 0.0 , alpha = 0.0 , depth = 1.0 ):
175176 """
176177 Clears the FBO using ``glClear``.
177178 """
178- self .bind ()
179+ self .use ()
179180 self .fbo .clear (red = red , green = green , blue = blue , alpha = alpha , depth = depth )
180181 self .release ()
181182
0 commit comments