88import OpenGL
99OpenGL .ERROR_CHECKING = False # noqa
1010
11- from demosys import context , resources
11+ from demosys import resources
1212from demosys .conf import settings
1313from demosys .effects .registry import Effect
14- from demosys .opengl .fbo import WindowFBO
1514from demosys .scene import camera
1615from demosys .utils import module_loading
1716
@@ -26,24 +25,19 @@ def run(manager=None):
2625 print ("window class" , window_cls_name )
2726 window_cls = module_loading .import_string (window_cls_name )
2827 window = window_cls ()
29-
30- window .manager = manager
31- context .WINDOW = window
3228 window .print_context_info ()
33-
34- WindowFBO .window = window
35- window .fbo = WindowFBO
29+ window .manager = manager
3630
3731 print ("Loader started at" , time .time ())
3832
3933 # Inject attributes into the base Effect class
40- setattr (Effect , '_window_width' , context . WINDOW .buffer_width )
41- setattr (Effect , '_window_height' , context . WINDOW .buffer_height )
42- setattr (Effect , '_window_aspect' , context . WINDOW .aspect_ratio )
43- setattr (Effect , '_ctx' , context .ctx () )
34+ setattr (Effect , '_window_width' , window .buffer_width )
35+ setattr (Effect , '_window_height' , window .buffer_height )
36+ setattr (Effect , '_window_aspect' , window .aspect_ratio )
37+ setattr (Effect , '_ctx' , window .ctx )
4438
4539 # Set up the default system camera
46- window .sys_camera = camera .SystemCamera (aspect = context . WINDOW .aspect_ratio , fov = 60.0 , near = 1 , far = 1000 )
40+ window .sys_camera = camera .SystemCamera (aspect = window .aspect_ratio , fov = 60.0 , near = 1 , far = 1000 )
4741 setattr (Effect , '_sys_camera' , window .sys_camera )
4842
4943 # Initialize Effects
@@ -66,22 +60,20 @@ def run(manager=None):
6660 window .timer .start ()
6761
6862 # Main loop
69- frames , frame_time = 0 , 60.0 / 1000.0
63+ frame_time = 60.0 / 1000.0
7064 # time_start = glfw.get_time()
7165 time_start = time .time ()
7266 prev_time = window .timer .get_time ()
7367
7468 while not window .should_close ():
7569 current_time = window .timer .get_time ()
7670
71+ window .use ()
7772 window .viewport ()
7873 window .clear ()
79-
80- manager .draw (current_time , frame_time , WindowFBO )
81-
74+ window .draw (current_time , frame_time )
8275 window .swap_buffers ()
8376
84- frames += 1
8577 frame_time = current_time - prev_time
8678 prev_time = current_time
8779
@@ -91,6 +83,6 @@ def run(manager=None):
9183 window .terminate ()
9284
9385 if duration > 0 :
94- fps = round (frames / duration , 2 )
95- print ("Duration: {}s rendering {} frames at {} fps" .format (duration , frames , fps ))
86+ fps = round (window . frames / duration , 2 )
87+ print ("Duration: {}s rendering {} frames at {} fps" .format (duration , window . frames , fps ))
9688 print ("Timeline duration:" , duration_timer )
0 commit comments