def open_window(self): if not self.window: self.input = {"button": None, "mouse": (0, 0)} # get glfw started if self.run_independently: glfw.init() glfw.window_hint(glfw.SCALE_TO_MONITOR, glfw.TRUE) self.window = glfw.create_window(self.window_size[0], self.window_size[1], self.name, None, None) else: self.window = glfw.create_window( self.window_size[0], self.window_size[1], self.name, None, glfw.get_current_context(), ) self.other_window = glfw.get_current_context() glfw.make_context_current(self.window) glfw.swap_interval(0) glfw.set_window_pos(self.window, window_position_default[0], window_position_default[1]) # Register callbacks window glfw.set_framebuffer_size_callback(self.window, self.on_resize) glfw.set_window_iconify_callback(self.window, self.on_iconify) glfw.set_key_callback(self.window, self.on_window_key) glfw.set_char_callback(self.window, self.on_window_char) glfw.set_mouse_button_callback(self.window, self.on_window_mouse_button) glfw.set_cursor_pos_callback(self.window, self.on_pos) glfw.set_scroll_callback(self.window, self.on_scroll) # get glfw started if self.run_independently: glutils.init() self.basic_gl_setup() self.sphere = glutils.Sphere(20) self.glfont = fs.Context() self.glfont.add_font("opensans", get_opensans_font_path()) self.glfont.set_size(18) self.glfont.set_color_float((0.2, 0.5, 0.9, 1.0)) self.on_resize(self.window, *glfw.get_framebuffer_size(self.window)) glfw.make_context_current(self.other_window)
def open_window(self): if not self.window: self.input = {"button": None, "mouse": (0, 0)} # get glfw started if self.run_independently: glfwInit() glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE) self.window = glfwCreateWindow(self.window_size[0], self.window_size[1], self.name, None) else: self.window = glfwCreateWindow( self.window_size[0], self.window_size[1], self.name, None, share=glfwGetCurrentContext(), ) self.other_window = glfwGetCurrentContext() glfwMakeContextCurrent(self.window) glfwSwapInterval(0) glfwSetWindowPos(self.window, window_position_default[0], window_position_default[1]) # Register callbacks window glfwSetFramebufferSizeCallback(self.window, self.on_resize) glfwSetWindowIconifyCallback(self.window, self.on_iconify) glfwSetKeyCallback(self.window, self.on_window_key) glfwSetCharCallback(self.window, self.on_window_char) glfwSetMouseButtonCallback(self.window, self.on_window_mouse_button) glfwSetCursorPosCallback(self.window, self.on_pos) glfwSetScrollCallback(self.window, self.on_scroll) # get glfw started if self.run_independently: glutils.init() self.basic_gl_setup() self.sphere = glutils.Sphere(20) self.glfont = fs.Context() self.glfont.add_font("opensans", get_opensans_font_path()) self.glfont.set_size(18) self.glfont.set_color_float((0.2, 0.5, 0.9, 1.0)) self.on_resize(self.window, *glfwGetFramebufferSize(self.window)) glfwMakeContextCurrent(self.other_window)
def open_window(self): if not self.window: self.input = {'button':None, 'mouse':(0,0)} # get glfw started if self.run_independently: glfwInit() self.window = glfwCreateWindow(self.window_size[0], self.window_size[1], self.name, None ) else: self.window = glfwCreateWindow(self.window_size[0], self.window_size[1], self.name, None, share= glfwGetCurrentContext() ) self.other_window = glfwGetCurrentContext(); glfwMakeContextCurrent(self.window) glfwSetWindowPos(self.window,0,0) # Register callbacks window glfwSetFramebufferSizeCallback(self.window,self.on_resize) glfwSetWindowIconifyCallback(self.window,self.on_iconify) glfwSetKeyCallback(self.window,self.on_key) glfwSetCharCallback(self.window,self.on_char) glfwSetMouseButtonCallback(self.window,self.on_button) glfwSetCursorPosCallback(self.window,self.on_pos) glfwSetScrollCallback(self.window,self.on_scroll) # get glfw started if self.run_independently: glutils.init() self.basic_gl_setup() self.sphere = glutils.Sphere(20) self.glfont = fs.Context() self.glfont.add_font('opensans',get_opensans_font_path()) self.glfont.set_size(18) self.glfont.set_color_float((0.2,0.5,0.9,1.0)) self.on_resize(self.window,*glfwGetFramebufferSize(self.window)) glfwMakeContextCurrent(self.other_window)