def get_config(self): if not self.config: platform = pyglet.window.get_platform() self.display = platform.get_default_display() self.screen = self.display.get_screens()[0] for template_config in [ Config(double_buffer=True, depth_size=32), Config(double_buffer=True, depth_size=24), Config(double_buffer=True, depth_size=16)]: try: self.config = self.screen.get_best_config(template_config) break except pyglet.window.NoSuchConfigException: pass if not self.config: raise pyglet.window.NoSuchConfigException( 'No standard config is available.') if not self.config.is_complete(): print 'not complete' self.config = self.screen.get_best_config(self.config) #print self.config.get_gl_attributes() if not self.context: self.context = self.config.create_context(pyglet.gl.current_context)
def get_window_config(): platform = pyglet.canvas.get_display() screen = platform.get_default_screen() template = Config(double_buffer=True, sample_buffers=1, samples=4) try: config = screen.get_best_config(template) except pyglet.window.NoSuchConfigException: template = Config() config = screen.get_best_config(template) return config
def __init__(self, width, height): conf = Config(sample_buffers=1, samples=4, depth_size=16, double_buffer=True) super(Main_Window2, self).__init__(Game.WIDTH, Game.HEIGHT, config=conf) self.push_handlers(keys) self.gui = glooey.Gui(self, gui_batch) self.client = Game_Client2(width, height, self.gui, stack) start_button = Start_Button(self.client) start_button.right_padding = 170 vbox.add(start_button) vbox.top_padding = 250 exit_button = Exit_Button() exit_button.right_padding = 170 def exit(widget): sys.exit() exit_button.on_click = exit vbox.add(exit_button) self.gui.add(stack) self.ping = pyglet.text.HTMLLabel( '<font face="Arial" size="13" color="white"><b>latency: %3.3f ms fps:%3.3f</b></font>' % (self.client._client.latency, pyglet.clock.get_fps()), x=self.width - 130, y=self.height - 12, anchor_x='center', anchor_y='center')
def _init_and_start_app(self): # Try multiple configs starting with target OpenGL version # and multisampling and removing these options if exception # Note: multisampling not available on all hardware from pyglet.gl import Config confs = [ Config(sample_buffers=1, samples=4, depth_size=24, double_buffer=True, major_version=TARGET_OPEN_GL_MAJOR, minor_version=TARGET_OPEN_GL_MINOR), Config(depth_size=24, double_buffer=True, major_version=TARGET_OPEN_GL_MAJOR, minor_version=TARGET_OPEN_GL_MINOR), Config(sample_buffers=1, samples=4, depth_size=24, double_buffer=True, major_version=MIN_OPEN_GL_MAJOR, minor_version=MIN_OPEN_GL_MINOR), Config(depth_size=24, double_buffer=True, major_version=MIN_OPEN_GL_MAJOR, minor_version=MIN_OPEN_GL_MINOR) ] for conf in confs: try: super(Viewer, self).__init__(config=conf, resizable=True, width=self._viewport_size[0], height=self._viewport_size[1]) break except pyglet.window.NoSuchConfigException: pass if not self.context: raise ValueError('Unable to initialize an OpenGL 3+ context') clock.schedule_interval(Viewer._time_event, 1.0 / self.viewer_flags['refresh_rate'], self) self.switch_to() self.set_caption(self.viewer_flags['window_title']) pyglet.app.run()
def _init_and_start_app(self): from pyglet.gl import Config conf = Config(sample_buffers=1, samples=4, depth_size=24, double_buffer=True, major_version=OPEN_GL_MAJOR, minor_version=OPEN_GL_MINOR) super(Viewer, self).__init__(config=conf, resizable=True, width=self._viewport_size[0], height=self._viewport_size[1]) if self.context.config.major_version < 3: raise ValueError('Unable to initialize an OpenGL 3+ context') clock.schedule_interval( Viewer._time_event, 1.0 / self.viewer_flags['refresh_rate'], self ) self.switch_to() self.set_caption(self.viewer_flags['window_title']) pyglet.app.run()
def init_Viewer(self): """ Open the pyglet window and initiate OpenGL from within viewer.Viewer """ if self.participant: enable_stereo = self.participant['stereo'] else: enable_stereo = False # Setup the config config = Config(depth_size=DEPTH_SIZE, double_buffer=True, sample_buffers=1, samples=4, stereo=enable_stereo) # Open the window using pyglet self.window = Viewer(self.participant, caption=EXP_NAME, config=config, fullscreen=FULLSCREEN, resizable=False, screen=0) # Run pyglet run()
def __init__(self): display = pyglet.canvas.get_display() config = display.get_default_screen().get_best_config(Config()) config.major_version = 3 config.minor_version = 3 context = config.create_context(None) Window.__init__(self, 800, 600, visible=False, resizable=True, caption='Tinyblend example', context=context) self.vao = (GLuint * 1)() glGenVertexArrays(1, self.vao) glBindVertexArray(self.vao[0]) # Load shaders shader = shaders.from_files_names('shaders/main.glsl.vert', 'shaders/main.glsl.frag') shader.owned = False shader.use() shader.enable_all_attributes() self.shader = shader # Uniforms matrices setup self.rotation = [-90, 0, 0] self.position = [0, 0, -4.5] shaders.transpose_matrices(False) self.upload_uniforms() # Scene creation self.setup_scene() # Show the window self.set_visible()
colours = map(int, colours) vertex_list = pyglet.graphics.vertex_list(len(element), ('v2f/static', positions), ('c4B/static', flatten(map(lambda x: (x,x,x,192), colours))) ) vLists.append(vertex_list) return vLists counter = 0 vLists = None try: config = Config(sample_buffers=1, samples=4, depth_size=16, double_buffer=True) window = AppWindow(resizable=True, config=config) except pyglet.window.NoSuchConfigException: window = AppWindow(resizable=True) #~ #vLists = makevLists(path + inputFiles[0]) allvLists = [(inputFile, makevLists(path + inputFile)) for inputFile in inputFiles] def update_vlist(): global counter, currentInputFile, vLists, displayLists # Kill the display lists displayLists = {} counter %= len(allvLists)
logger.info("Hack Starting") logger.info(f"Hack Version: {version}") # Initialize our SoT Hack object, and do a first run of reading actors smr = SoTMemoryReader() smr.read_actors() # Custom Debug mode for using a literal python interpreter debugger # to validate our fields. Does not generate a GUI. if DEBUG: while True: smr.read_actors() # You may want to add/modify this custom config per the pyglet docs to # disable vsync or other options: https://tinyurl.com/45tcx6eu config = Config(double_buffer=True, depth_size=24, alpha_size=8) # Create an overlay window with Pyglet at the same size as our SoT Window window = pyglet.window.Window(SOT_WINDOW_W, SOT_WINDOW_H, vsync=False, style='overlay', config=config, caption="DougTheDruid's ESP Framework") # window.set_caption('A different caption') hwnd = window._hwnd # pylint: disable=protected-access # Move our window to the same location that our SoT Window is at window.set_location(SOT_WINDOW[0], SOT_WINDOW[1]) @window.event