Esempio n. 1
0
 def __init__(self, width=640, height=480, fullscreen=False, aspect=None):
     self.gl = gl
     glut.glutInit(sys.argv)
     glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB | glut.GLUT_DEPTH)
     glut.glutInitWindowPosition(0, 0)
     glut.glutCreateWindow(b"BlitzLoop Karaoke")
     if not fullscreen:
         glut.glutReshapeWindow(width, height)
     else:
         glut.glutSetCursor(glut.GLUT_CURSOR_NONE)
     BaseDisplay.__init__(self, width, height, fullscreen, aspect)
     self._on_reshape(width, height)
     if fullscreen:
         self.saved_size = (width, height)
         glut.glutFullScreen()
     glut.glutDisplayFunc(self._render)
     glut.glutIdleFunc(self._render)
     glut.glutReshapeFunc(self._on_reshape)
     glut.glutKeyboardFunc(self._on_keyboard)
     glut.glutSpecialFunc(self._on_keyboard)
     try:
         glut.glutSetOption(glut.GLUT_ACTION_ON_WINDOW_CLOSE, glut.GLUT_ACTION_GLUTMAINLOOP_RETURNS)
         print("Using FreeGLUT mainloop return feature")
     except:
         pass
     self._initialize()
Esempio n. 2
0
 def __init__(self, width=640, height=480, fullscreen=False, aspect=None):
     self.gl = gl
     glut.glutInit(sys.argv)
     glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB
                              | glut.GLUT_DEPTH)
     glut.glutInitWindowPosition(0, 0)
     glut.glutCreateWindow(b"BlitzLoop Karaoke")
     if not fullscreen:
         glut.glutReshapeWindow(width, height)
     else:
         glut.glutSetCursor(glut.GLUT_CURSOR_NONE)
     BaseDisplay.__init__(self, width, height, fullscreen, aspect)
     self._on_reshape(width, height)
     if fullscreen:
         self.saved_size = (width, height)
         glut.glutFullScreen()
     glut.glutDisplayFunc(self._render)
     glut.glutIdleFunc(self._render)
     glut.glutReshapeFunc(self._on_reshape)
     glut.glutKeyboardFunc(self._on_keyboard)
     glut.glutSpecialFunc(self._on_keyboard)
     try:
         glut.glutSetOption(glut.GLUT_ACTION_ON_WINDOW_CLOSE,
                            glut.GLUT_ACTION_GLUTMAINLOOP_RETURNS)
         print("Using FreeGLUT mainloop return feature")
     except:
         pass
     self._initialize()
Esempio n. 3
0
    def init(self):
        # Initialize display
        global global_init
        if not global_init:
            glut.glutInit()
            glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGBA
                                     | glut.GLUT_DEPTH | glut.GLUT_ALPHA)
            glut.glutCreateWindow(b'fbmatrix')
            global_init = True

        if self.preview or self.raw:
            glut.glutReshapeWindow(512, 512)
        elif self.emulate:
            glut.glutReshapeWindow(1024, 512)

        glut.glutReshapeFunc(lambda w, h: self.reshape(w, h))
        glut.glutDisplayFunc(lambda: self.display())
        glut.glutKeyboardFunc(lambda k, x, y: self.keyboard(k, x, y))

        # Primary offscreen framebuffer
        self.mainfbo = fbo.FBO(self.columns,
                               32,
                               mag_filter=gl.GL_NEAREST,
                               min_filter=gl.GL_NEAREST)

        # Initialize display shader
        layoutfile = 'layout.json'

        if self.displaytype == 'ws2811':
            self.signalgenerator = displays.ws2811.signalgenerator(
                layoutfile, supersample=self.supersample)
            self.signalgenerator.setTexture(self.mainfbo.getTexture())
        elif self.displaytype == 'hub75e':
            self.signalgenerator = displays.hub75e.signalgenerator(
                columns=self.columns,
                rows=self.rows,
                supersample=self.supersample,
                order=self.order,
                oe=self.oe,
                extract=self.extract)
            self.signalgenerator.setTexture(self.mainfbo.getTexture())

        # Emulation shader
        if self.emulate or self.preview:
            self.texquad = geometry.simple.texquad()
            self.texquad.setTexture(self.mainfbo.getTexture())

        # Tree emulator
        if self.emulate:
            self.tree = assembly.tree.tree(layoutfile)
            self.tree.setTexture(self.mainfbo.getTexture())

        # Render
        glut.glutSetCursor(glut.GLUT_CURSOR_NONE)
        if not self.raw and not self.preview and not self.emulate:
            glut.glutFullScreen()
Esempio n. 4
0
def init_gl(argv, win_name="BoarGL Application"):
    # Glut init
    # --------------------------------------
    glut.glutInit(sys.argv)
    glut.glutInitDisplayMode(glut.GLUT_DOUBLE |
                             glut.GLUT_RGBA |
                             glut.GLUT_DEPTH  |
                             glut.GLUT_3_2_CORE_PROFILE)

    if "-w" in argv:
        print "creating window"
        glut.glutCreateWindow(win_name)
    else:
        print "going fullscreen"
        glut.glutGameModeString("2880x1800:32@60")
        # The application will enter fullscreen
        glut.glutEnterGameMode()

    print gl.glGetString(gl.GL_RENDERER)
    print gl.glGetString(gl.GL_VERSION)

    # OpenGL initalization
    gl.glClearColor(0, 0, 0, 1)

    # hide mouse cursor
    glut.glutSetCursor(glut.GLUT_CURSOR_NONE)

    gl.glEnable(gl.GL_BLEND)
    gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)

    gl.glEnable(gl.GL_CULL_FACE);
    gl.glCullFace(gl.GL_BACK);
    gl.glFrontFace(gl.GL_CCW);

    gl.glEnable(gl.GL_DEPTH_TEST)
    gl.glDepthMask(gl.GL_TRUE);
    gl.glDepthFunc(gl.GL_LEQUAL);
    gl.glDepthRange(0.0, 1.0);

    gl.GL_TEXTURE_WRAP_S = gl.GL_CLAMP_TO_EDGE
    gl.GL_TEXTURE_WRAP_T = gl.GL_CLAMP_TO_EDGE

    gl.glPolygonOffset(1, 1)
    gl.glEnable(gl.GL_LINE_SMOOTH)
    gl.glLineWidth(0.75)
Esempio n. 5
0
    def __init__(self, width=640, height=480, fullscreen=False, aspect=None):
        self.gl = gl
        glut.glutInit(sys.argv)
        glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB | glut.GLUT_DEPTH)
        glut.glutInitWindowPosition(0, 0)
        glut.glutCreateWindow(b"BlitzLoop Karaoke")
        if not fullscreen:
            glut.glutReshapeWindow(width, height)
        else:
            glut.glutSetCursor(glut.GLUT_CURSOR_NONE)
        BaseDisplay.__init__(self, width, height, fullscreen, aspect)
        self._on_reshape(width, height)
        if fullscreen:
            self.saved_size = (width, height)
            glut.glutFullScreen()
        glut.glutDisplayFunc(self._render)
        glut.glutIdleFunc(self._render)
        glut.glutReshapeFunc(self._on_reshape)
        glut.glutKeyboardFunc(self._on_keyboard)
        glut.glutSpecialFunc(self._on_keyboard)

        self._initialize()
Esempio n. 6
0
	def __init__(self, width=640, height=480, fullscreen=False, aspect=None):
		self.kbd_handler = None
		self.win_width = width
		self.win_height = height
		glut.glutInit(sys.argv)
		glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB | glut.GLUT_DEPTH)
		glut.glutInitWindowPosition(0, 0)
		glut.glutCreateWindow("Karaoke")
		if not fullscreen:
			glut.glutReshapeWindow(width, height)
		else:
			glut.glutSetCursor(glut.GLUT_CURSOR_NONE)
		self.win_width = width
		self.win_height = height
		self.set_aspect(aspect)
		self._on_reshape(width, height)
		if fullscreen:
			glut.glutFullScreen()
		glut.glutDisplayFunc(self._render)
		glut.glutIdleFunc(self._render)
		glut.glutReshapeFunc(self._on_reshape)
		glut.glutKeyboardFunc(self._on_keyboard)
		glut.glutSpecialFunc(self._on_keyboard)
Esempio n. 7
0
 def __init__(self, width=640, height=480, fullscreen=False, aspect=None):
     self.kbd_handler = None
     self.win_width = width
     self.win_height = height
     glut.glutInit(sys.argv)
     glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB
                              | glut.GLUT_DEPTH)
     glut.glutInitWindowPosition(0, 0)
     glut.glutCreateWindow("BlitzLoop Karaoke")
     if not fullscreen:
         glut.glutReshapeWindow(width, height)
     else:
         glut.glutSetCursor(glut.GLUT_CURSOR_NONE)
     self.win_width = width
     self.win_height = height
     self.set_aspect(aspect)
     self._on_reshape(width, height)
     if fullscreen:
         glut.glutFullScreen()
     glut.glutDisplayFunc(self._render)
     glut.glutIdleFunc(self._render)
     glut.glutReshapeFunc(self._on_reshape)
     glut.glutKeyboardFunc(self._on_keyboard)
     glut.glutSpecialFunc(self._on_keyboard)
        boosts.clear()
        heart_remove_order.queue.clear()
        boost_remove_order.queue.clear()
        hearts.clear()
        boost_remove_order_New = queue.Queue()
        heart_remove_order_New = queue.Queue()
        for j in initial_hearts:
            j.join_set(hearts)
            heart_remove_order_New.put(j)
        for k in temp_boosts:
            k.join_set(boosts)
            boost_remove_order_New.put(k)
        boost_remove_order = boost_remove_order_New
        heart_remove_order = heart_remove_order_New


# glut.glutKeyboardFunc(keyboard_input)


def mouse_passive_motion(x, y):
    # print(x, y)
    a = x


glut.glutSetCursor(glut.GLUT_CURSOR_NONE)
glut.glutPassiveMotionFunc(mouse_passive_motion)

# Start the Main Loop ----------------------------------------------------------------|

glut.glutMainLoop()