def __init_display(self, sf, fps): bgcolor = (0.0, 0.0, 0.0, 0.0) # fix dispmanx alpha layer https://github.com/tipam/pi3d/issues/197 monkey_patch() self.width = 1920 if sf == 0: #adapt to screen size self.DISPLAY = pi3d.Display.create(background=bgcolor, layer=1) sf = self.width / self.DISPLAY.width self.height = self.DISPLAY.height * sf else: logger.debug("Forcing size") self.height = 1080 self.DISPLAY = pi3d.Display.create(x=0, y=0, w=int(self.width / sf), h=int(self.height / sf), background=bgcolor, layer=1) self.DISPLAY.frames_per_second = fps logger.info("Display %dx%d@%d", self.DISPLAY.width, self.DISPLAY.height, self.DISPLAY.frames_per_second) self.CAMERA = pi3d.Camera(is_3d=False, scale=1 / sf) opengles.glBlendFuncSeparate(pi3d.constants.GL_SRC_ALPHA, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA, 1, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA) self.sf = sf
def __init_display(self, sf, fps): bgcolor = (0.0, 0.0, 0.0, 0.2) if self.is_pi(): self.__validate_gpu_mem() if sf == 0: #adapt to screen size self.DISPLAY = pi3d.Display.create(background=bgcolor, layer=1) aspect = fractions.Fraction(self.DISPLAY.width, self.DISPLAY.height) if aspect != fractions.Fraction(16, 9): logger.warn( "Your display aspect ratio is %s instead of 16/9 expect some black bars", aspect) sf = 1920 / self.DISPLAY.width else: logger.info("Forcing size") self.DISPLAY = pi3d.Display.create(x=0, y=0, w=int(1920 / sf), h=int(1080 / sf), background=bgcolor, layer=1) self.DISPLAY.frames_per_second = fps logger.info("Display %dx%d@%d", self.DISPLAY.width, self.DISPLAY.height, self.DISPLAY.frames_per_second) self.CAMERA = pi3d.Camera(is_3d=False, scale=1 / sf) opengles.glBlendFuncSeparate(pi3d.constants.GL_SRC_ALPHA, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA, 1, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA)
def __init_display(self, sf, fps): if is_pi() and config.blank_console: call_and_log("setterm -blank force", shell=True) bgcolor = (0.0, 0.0, 0.0, 0.0) # fix dispmanx alpha layer https://github.com/tipam/pi3d/issues/197 monkey_patch() self.width = 1920 if sf == 0: #adapt to screen size self.DISPLAY = pi3d.Display.create(background=bgcolor, layer=1) sf = self.width / self.DISPLAY.width self.height = self.DISPLAY.height * sf else: logger.debug("Forcing size") self.height = 1080 self.DISPLAY = pi3d.Display.create(x=0, y=0, w=int(self.width / sf), h=int(self.height / sf), background=bgcolor, layer=1) self.DISPLAY.frames_per_second = fps logger.info("Display %dx%d@%d", self.DISPLAY.width, self.DISPLAY.height, self.DISPLAY.frames_per_second) self.CAMERA = pi3d.Camera(is_3d=False, scale=1 / sf) opengles.glBlendFuncSeparate(pi3d.constants.GL_SRC_ALPHA, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA, 1, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA) self.sf = sf
def __init_display(self, sf, fps): if is_pi() and config.blank_console: call_and_log("video/blank_console.sh blank", shell=True) bgcolor = (0.0, 0.0, 0.0, 0.0) self.width = 1920 if sf == 0: #adapt to screen size self.DISPLAY = pi3d.Display.create(background=bgcolor, layer=1, use_pygame=True) sf = self.width / self.DISPLAY.width self.height = self.DISPLAY.height * sf else: logger.debug("Forcing size") self.height = 1080 self.DISPLAY = pi3d.Display.create(x=0, y=0, w=int(self.width / sf), h=int(self.height / sf), background=bgcolor, layer=1, use_pygame=True) self.DISPLAY.frames_per_second = fps logger.info("Display %dx%d@%d", self.DISPLAY.width, self.DISPLAY.height, self.DISPLAY.frames_per_second) self.CAMERA = pi3d.Camera(is_3d=False, scale=1 / sf) opengles.glBlendFuncSeparate(pi3d.constants.GL_SRC_ALPHA, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA, 1, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA) self.sf = sf
def __init_display(self, sf, fps): bgcolor = (0.0, 0.0, 0.0, 0.0) # fix dispmanx alpha layer https://github.com/tipam/pi3d/issues/197 monkey_patch() if sf == 0: #adapt to screen size self.DISPLAY = pi3d.Display.create(background=bgcolor, layer=1) aspect = fractions.Fraction(self.DISPLAY.width, self.DISPLAY.height) if aspect != fractions.Fraction(16, 9): logger.warn( "Your display aspect ratio is %s instead of 16/9 expect scaled background and a bad layout", aspect) sf = 1920 / self.DISPLAY.width else: logger.debug("Forcing size") self.DISPLAY = pi3d.Display.create(x=0, y=0, w=int(1920 / sf), h=int(1080 / sf), background=bgcolor, layer=1) self.DISPLAY.frames_per_second = fps logger.info("Display %dx%d@%d", self.DISPLAY.width, self.DISPLAY.height, self.DISPLAY.frames_per_second) self.CAMERA = pi3d.Camera(is_3d=False, scale=1 / sf) opengles.glBlendFuncSeparate(pi3d.constants.GL_SRC_ALPHA, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA, 1, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA) self.sf = sf
def __init_display(self, sf, fps): bgcolor = (0.0, 0.0, 0.0, 0.2) if sf == 0: #adapt to screen size self.DISPLAY = pi3d.Display.create(background=bgcolor, layer=1) sf = 1920 / self.DISPLAY.width else: logger.info("Forcing size") self.DISPLAY = pi3d.Display.create(x=0, y=0, w=int(1920 / sf), h=int(1080 / sf), background=bgcolor, layer=1) self.DISPLAY.frames_per_second = fps logger.info("Display %dx%d@%d", self.DISPLAY.width, self.DISPLAY.height, self.DISPLAY.frames_per_second) self.CAMERA = pi3d.Camera(is_3d=False, scale=1 / sf) opengles.glBlendFuncSeparate(pi3d.constants.GL_SRC_ALPHA, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA, 1, pi3d.constants.GL_ONE_MINUS_SRC_ALPHA)