Beispiel #1
0
 def render(self, x, y, w=None, h=None, z=0.0, opacity=1.0):
     if w is None:
         w = self.w
     if h is None:
         h = self.h
     self.bind()
     fs_emu_texturing(True)
     if self.gl_type == gl.GL_RGBA or opacity < 1.0:
         fs_emu_blending(True)
     else:
         fs_emu_blending(False)
     gl.glBegin(gl.GL_QUADS)
     if opacity < 1.0:
         gl.glColor4f(opacity, opacity, opacity, opacity)
     else:
         gl.glColor3f(1.0, 1.0, 1.0)
     gl.glTexCoord(0.0, 1.0)
     gl.glVertex3f(x, y, z)
     gl.glTexCoord(1.0, 1.0)
     gl.glVertex3f(x + w, y, z)
     gl.glTexCoord(1.0, 0.0)
     gl.glVertex3f(x + w, y + h, z)
     gl.glTexCoord(0.0, 0.0)
     gl.glVertex3f(x, y + h, z)
     gl.glEnd()
Beispiel #2
0
 def render(self, x, y, w=None, h=None, z=0.0, opacity=1.0):
     if w is None:
         w = self.w
     if h is None:
         h = self.h
     self.bind()
     fs_emu_texturing(True)
     if self.gl_type == gl.GL_RGBA or opacity < 1.0:
         fs_emu_blending(True)
     else:
         fs_emu_blending(False)
     gl.glBegin(gl.GL_QUADS)
     if opacity < 1.0:
         gl.glColor4f(opacity, opacity, opacity, opacity)
     else:
         gl.glColor3f(1.0, 1.0, 1.0)
     gl.glTexCoord(0.0, 1.0)
     gl.glVertex3f(x, y, z)
     gl.glTexCoord(1.0, 1.0)
     gl.glVertex3f(x + w, y, z)
     gl.glTexCoord(1.0, 0.0)
     gl.glVertex3f(x + w, y + h, z)
     gl.glTexCoord(0.0, 0.0)
     gl.glVertex3f(x, y + h, z)
     gl.glEnd()
 def render(self):
     z = -0.999
     fs_emu_texturing(False)
     fs_emu_blending(False)
     gl.glBegin(gl.GL_QUADS)
     gl.glColor3f(0.0, 0.0, 0.0)
     # glVertex3f(0, 365, z)
     # glVertex3f(1270, 365, z)
     gl.glVertex3f(0, 400, z)
     gl.glVertex3f(1270, 400, z)
     gl.glColor3f(0.25, 0.25, 0.25)
     gl.glVertex3f(1270, 1080 - 60, z)
     gl.glVertex3f(0, 1080 - 60, z)
     gl.glEnd()
 def render(self):
     z = -0.999
     fs_emu_texturing(False)
     fs_emu_blending(False)
     gl.glBegin(gl.GL_QUADS)
     gl.glColor3f(0.0, 0.0, 0.0)
     # glVertex3f(0, 365, z)
     # glVertex3f(1270, 365, z)
     gl.glVertex3f(0, 400, z)
     gl.glVertex3f(1270, 400, z)
     gl.glColor3f(0.25, 0.25, 0.25)
     gl.glVertex3f(1270, 1080 - 60, z)
     gl.glVertex3f(0, 1080 - 60, z)
     gl.glEnd()
Beispiel #5
0
def render_debug_square_2():
    global debug_x_2
    Render.get().hd_perspective()
    fs_emu_texturing(False)
    gl.glBegin(gl.GL_QUADS)
    gl.glColor3f(0.2, 0.2, 0.2)
    x = debug_x_2
    debug_x_2 += 1
    if debug_x_2 >= 1920:
        debug_x_2 = 0
    y = 989 + 5
    z = 0.99
    gl.glVertex3f(x, y, z)
    gl.glVertex3f(x + 20, y, z)
    gl.glVertex3f(x + 20, y + 10, z)
    gl.glVertex3f(x, y + 10, z)
    gl.glEnd()
    fs_emu_texturing(True)
Beispiel #6
0
def render_debug_square():
    global debug_x
    Render.get().hd_perspective()
    fs_emu_texturing(False)
    gl.glBegin(gl.GL_QUADS)
    gl.glColor3f(1.0, 1.0, 1.0)
    x = debug_x
    debug_x += 1
    if debug_x >= 1920:
        debug_x = 0
    y = 989
    z = 0.99
    gl.glVertex3f(x, y, z)
    gl.glVertex3f(x + 20, y, z)
    gl.glVertex3f(x + 20, y + 20, z)
    gl.glVertex3f(x, y + 20, z)
    gl.glEnd()
    fs_emu_texturing(True)
Beispiel #7
0
 def render_background(self):
     if self.background_texture:
         gl.glBindTexture(gl.GL_TEXTURE_2D, self.background_texture)
         gl.glColor3f(1.0, 1.0, 1.0)
     else:
         gl.glBindTexture(gl.GL_TEXTURE_2D, 0)
         # r, g, b a = self.background_color
         gl.glColor4f(*self.background_color)
     gl.glBegin(gl.GL_QUADS)
     bgx, bgy = self.background_texture_offset
     gl.glTexCoord(bgx + 0.0, bgy + 1.0)
     gl.glVertex2f(0, 0)
     gl.glTexCoord(bgx + 1.0, bgy + 1.0)
     gl.glVertex2f(self.width, 0)
     gl.glTexCoord(bgx + 1.0, bgy + 0.0)
     gl.glVertex2f(self.width, self.height)
     gl.glTexCoord(bgx + 0.0, bgy + 0.0)
     gl.glVertex2f(0, self.height)
     gl.glEnd()
def render_bottom_bar_screens(item):
    global last_item_id
    global item_time
    if id(item) != last_item_id:
        last_item_id = id(item)
        item_time = State.get().time

    gl.glColor3f(1.0, 1.0, 1.0)
    fs_emu_texturing(True)
    fs_emu_blending(False)

    for i in range(3, -1, -1):
        if State.get().time - item_time > 0.1 + 0.05 * i:
            texture = item.get_screen_texture(2 + i)
        else:
            texture = None
        if texture:
            # coords = (0, texture.w, texture.h, 0)
            coords = COORDS
        else:
            texture, coords = static()
            # While rendering static, we must continue rendering.
            Render.get().dirty = True

        texture.bind()
        texture_rectangle(4 + 539 + 345 * i, 34, 308, 193, 0.2, *coords)
    if State.get().time - item_time > 0.1:
        texture = item.get_screen_texture(1)
    else:
        texture = None
    if texture:
        coords = COORDS
    else:
        texture, coords = static()
        # While rendering static, we must continue rendering.
        Render.get().dirty = True
    texture.bind()

    texture_rectangle(34, 34, 472, 295, 0.2, *coords)
Beispiel #9
0
def render_bottom_bar_screens(item):
    global last_item_id
    global item_time
    if id(item) != last_item_id:
        last_item_id = id(item)
        item_time = State.get().time

    gl.glColor3f(1.0, 1.0, 1.0)
    fs_emu_texturing(True)
    fs_emu_blending(False)

    for i in range(3, -1, -1):
        if State.get().time - item_time > 0.1 + 0.05 * i:
            texture = item.get_screen_texture(2 + i)
        else:
            texture = None
        if texture:
            # coords = (0, texture.w, texture.h, 0)
            coords = COORDS
        else:
            texture, coords = static()
            # While rendering static, we must continue rendering.
            Render.get().dirty = True

        texture.bind()
        texture_rectangle(4 + 539 + 345 * i, 34, 308, 193, 0.2, *coords)
    if State.get().time - item_time > 0.1:
        texture = item.get_screen_texture(1)
    else:
        texture = None
    if texture:
        coords = COORDS
    else:
        texture, coords = static()
        # While rendering static, we must continue rendering.
        Render.get().dirty = True
    texture.bind()

    texture_rectangle(34, 34, 472, 295, 0.2, *coords)
def render_wall():  # brightness=1.0):
    # glClearColor(0.1, 0.1, 0.1, 1.0)
    # glClear(GL_DEPTH_BUFFER_BIT);
    Render.get().hd_perspective()
    # fs_emu_ortho();
    # fs_emu_blending(FALSE);
    # fs_emu_texturing(FALSE);
    z = -0.999

    # glPushMatrix()
    # glTranslate(0.0, 0.0, 1.0)

    # transition y-coordinate between floor and wall
    split = 361
    fs_emu_blending(False)
    fs_emu_texturing(False)
    gl.glBegin(gl.GL_QUADS)

    gl.glColor3f(39.0 / 255.0, 44.0 / 255.0, 51.0 / 255.0)
    gl.glVertex3f(0, split, z)
    gl.glVertex3f(1920, split, z)
    color = 0
    gl.glColor3f(color, color, color)
    gl.glVertex3f(1920, 1020, z)
    gl.glVertex3f(0, 1020, z)

    gl.glVertex3f(0, 1020, z)
    gl.glVertex3f(1920, 1020, z)
    gl.glVertex3f(1920, 1080, z)
    gl.glVertex3f(0, 1080, z)

    color = 0
    gl.glColor3f(color, color, color)
    gl.glVertex3f(0, 0, z)
    gl.glVertex3f(1920, 0, z)
    gl.glColor3f(20.0 / 255.0, 22.0 / 255.0, 26.0 / 255.0)
    gl.glVertex3f(1920, split, z)
    gl.glVertex3f(0, split, z)

    gl.glEnd()
Beispiel #11
0
def render_wall():  # brightness=1.0):
    # glClearColor(0.1, 0.1, 0.1, 1.0)
    # glClear(GL_DEPTH_BUFFER_BIT);
    Render.get().hd_perspective()
    # fs_emu_ortho();
    # fs_emu_blending(FALSE);
    # fs_emu_texturing(FALSE);
    z = -0.999

    # glPushMatrix()
    # glTranslate(0.0, 0.0, 1.0)

    # transition y-coordinate between floor and wall
    splt = 361
    fs_emu_blending(False)
    fs_emu_texturing(False)
    gl.glBegin(gl.GL_QUADS)

    gl.glColor3f(39.0 / 255.0, 44.0 / 255.0, 51.0 / 255.0)
    gl.glVertex3f(0, splt, z)
    gl.glVertex3f(1920, splt, z)
    color = 0
    gl.glColor3f(color, color, color)
    gl.glVertex3f(1920, 1020, z)
    gl.glVertex3f(0, 1020, z)

    gl.glVertex3f(0, 1020, z)
    gl.glVertex3f(1920, 1020, z)
    gl.glVertex3f(1920, 1080, z)
    gl.glVertex3f(0, 1080, z)

    color = 0
    gl.glColor3f(color, color, color)
    gl.glVertex3f(0, 0, z)
    gl.glVertex3f(1920, 0, z)
    gl.glColor3f(20.0 / 255.0, 22.0 / 255.0, 26.0 / 255.0)
    gl.glVertex3f(1920, splt, z)
    gl.glVertex3f(0, splt, z)

    gl.glEnd()
Beispiel #12
0
    def render_content(self):
        Render.get().dirty = True

        # #x1 = -16 / 9 + 0.1
        # x1 = 0.1
        # #x2 = 16 / 9 - 0.1
        # x2 = self.width - 0.1
        # #y1 = 0.7
        # #y2 = 0.9
        # y1 = 1.6
        # y2 = 1.9
        x1 = 0
        x2 = self.width
        y1 = 1.7
        y2 = 2.0
        w = 0.03

        # t = (pygame.time.get_ticks() - self.start_time) // 1000
        alert_color = (1.0, 0.8, 0.0)
        t = int((time.time() - self.start_time * 1.6))
        if t % 2 == 0:
            gl.glBegin(gl.GL_QUADS)
            gl.glColor3f(*alert_color)
            gl.glVertex2f(x1, y1)
            gl.glVertex2f(x2, y1)
            gl.glVertex2f(x2, y2)
            gl.glVertex2f(x1, y2)
            gl.glColor3f(0.0, 0.0, 0.0)
            gl.glVertex2f(x1 + w, y1 + w)
            gl.glVertex2f(x2 - w, y1 + w)
            gl.glVertex2f(x2 - w, y2 - w)
            gl.glVertex2f(x1 + w, y2 - w)
            gl.glEnd()

        text = "Software Failure.  Press BACKSPACE or back button to continue."
        Render.get().text(text, self.guru_font, 0.2, 1.85, color=alert_color)
        text = self.splitted[-1]
        text = "Guru Meditation #{0}".format(text)
        Render.get().text(text, self.guru_font, 0.2, 1.77, color=alert_color)

        x = 0.2
        y = 0.15

        tw, th = Render.get().measure_text("M", self.detail_font)
        y += th
        lines = []
        max_line_size = 129
        for line in self.splitted:
            line = line.rstrip()
            while len(line) > max_line_size:
                lines.append(line[:max_line_size])
                line = line[max_line_size:]
            lines.append(line)

        for i, line in enumerate(reversed(lines)):
            if i == MAX_LINE:
                break
            s = (MAX_LINE - i) / MAX_LINE
            tw, th = Render.get().text(
                line, self.detail_font, x, y, color=(s, s, s, 1.0)
            )
            y += th
Beispiel #13
0
    def render(self, transition=1.0):
        Render.get().hd_perspective()

        # w = 560
        # h = 92
        # x = 1920 - w * transition
        # y = 1080 - 60 - h
        # y = 1080 - 60 - h - 44
        # z = -0.9

        item_top = 1080 - 90
        item_left = 1920 - 560 + 40

        item_left += Texture.sidebar_background_shadow.w * (1.0 - transition)

        gl.glPushMatrix()
        gl.glTranslate(0.0, 0.0, 0.7)
        # glTranslated((1.0 - transition) * g_tex_sidebar_background->width,
        # 0, 0)
        # fs_emu_set_texture(g_tex_sidebar_background)
        # fs_emu_render_texture_with_size(g_tex_sidebar_background,
        #         1920 - g_tex_sidebar_background->width,
        #         0, g_tex_sidebar_background->width,
        #         g_tex_sidebar_background->height)
        # fs_emu_render_sidebar()
        fs_emu_blending(True)
        fs_emu_texturing(True)
        gl.glDepthMask(False)
        Texture.sidebar_background_shadow.render(
            1920 - Texture.sidebar_background_shadow.w * transition, 0,
            Texture.sidebar_background_shadow.w,
            Texture.sidebar_background_shadow.h)
        gl.glDepthMask(True)
        gl.glPopMatrix()

        # x = x + 70
        # w = w - 70
        x = item_left
        y = item_top - 60
        w = 560 - 40 - 40
        h = 60

        for i, item in enumerate(self.items):
            if item.group:
                if i > 0:
                    # skip one half row before group heading
                    y -= h / 2
            selected = i == self.index and State.get().navigatable == self
            z = 0.71
            fs_emu_texturing(False)

            if selected:
                fg_color = [1.0, 1.0, 1.0, 1.0]
                gl.glBegin(gl.GL_QUADS)

                gl.glColor3f(0.00, 0x99 / 0xff, 0xcc / 0xff)
                gl.glVertex3f(x, y + 4, z)
                gl.glVertex3f(x + w, y + 4, z)
                gl.glVertex3f(x + w, y + h - 4, z)
                gl.glVertex3f(x, y + h - 4, z)
                # glColor3f(0.6, 0.6, 0.6)
                # glVertex3f(x, y + 4, z)
                # glVertex3f(x + w, y + 4, z)
                # glVertex3f(x + w, y + h, z)
                # glVertex3f(x, y + h, z)
                gl.glEnd()
            else:
                fg_color = [1.0, 1.0, 1.0, 1.0]

            # glBegin(GL_QUADS)
            # glColor3f(0.4, 0.4, 0.4)
            # glVertex3f(x, y, z)
            # glVertex3f(x + w, y, z)
            # glVertex3f(x + w, y + 4, z)
            # glVertex3f(x, y + 4, z)
            # glEnd()
            # fs_emu_texturing(True)

            if i > 0:
                fg_color[3] *= 0.35

            text = item.title

            # FIXME: REMOVE
            # fs_emu_blending(False)
            # fs_emu_blending(True)

            gl.glDisable(gl.GL_DEPTH_TEST)
            if item.group:
                BitmapFont.menu_font.render(text,
                                            x + 20,
                                            y + 14,
                                            r=0.0,
                                            g=0x99 / 0xff,
                                            b=0xcc / 0xff)
            else:
                BitmapFont.menu_font.render(text, x + 20, y + 14)
            gl.glEnable(gl.GL_DEPTH_TEST)
            # text = item.title.upper()
            # tw, th = Render.get().text(text, Font.main_path_font,
            #         x + 40, y + 43, color=fg_color)
            # text = item.subtitle.upper()
            # fg_color[3] = fg_color[3] * 0.4
            # text = item.title.upper()
            # tw, th = Render.get().text(text, Font.list_subtitle_font,
            #         x + 40, y + 18, color=fg_color)
            y -= h
Beispiel #14
0
def _render_menu(menu, what=None, skip_center_item=False):
    if what is None:
        what = ["ITEMS", "SHADOWS"]
    # print "render menu with", len(menu), "items"
    position = menu.get_current_position()
    # selected = menu.get_selected_index()
    assert not skip_center_item

    # min_item = 0
    # max_item = len(menu) - 1
    num_items = len(menu)
    # i_position = min(max_item, int(round(position)))
    i_position = int(round(position))

    # print position, " (", selected, ")"
    # print "selected", selected

    # glEnable(GL_DEPTH_TEST)

    def get_item_position(ip_distance):
        inverse = ip_distance < 0
        ip_distance = abs(ip_distance)
        # y = 0.02 - 0.5
        # y = 0.243
        y = 0.293
        z = -3.1
        if ip_distance < 1.0:
            x = ip_distance * 0.8
            ip_rotation = -45.0 * ip_distance
            z = z + 0.6 - 0.6 * ip_distance
        else:
            # x = 0.8 + 0.15 * (ip_distance - 1.0)
            # x = 0.8 + 0.20 * (ip_distance - 1.0)
            x = 0.8 + 0.33 * (ip_distance - 1.0)
            ip_rotation = -45.0
        if inverse:
            return [-x, y, z], -ip_rotation
        else:
            return [x, y, z], ip_rotation

    def yield_render_item_sequence():
        if not skip_center_item:
            yield i_position
        # if MenuGameTransition.value == 0: #< 0.00001:
        # for i in range(9, 0, -1):
        for i in range(1, 10):
            # if (i_position - i) >= min_item:
            yield i_position - i
            # if (i_position + i) <= max_item:
            yield i_position + i

    def yield_image_file_sequence():
        for img in menu[i_position % num_items].get_image_files():
            yield img
        for i in range(1, 12):
            # if (i_position - i) >= min_item:
            #     for img in menu[i_position - i].get_image_files():
            #         yield img
            # if (i_position + i) <= max_item:
            #     for img in menu[i_position + i].get_image_files():
            #         yield img
            for img in menu[(i_position - i) % num_items].get_image_files():
                yield img
            for img in menu[(i_position + i) % num_items].get_image_files():
                yield img

    item_data = []
    if "ITEMS" in what:
        TextureManager.get().load_images(list(yield_image_file_sequence()))
        # TextureManager.get().load_textures(1)

        center_item = None
        light1_position = [-1.5, 0.2, -2.3, 1.0]
        light2_position = [-0.5, 2.5, -2.3, 1.0]
        # glDisable(GL_LIGHT2)

        if LIGHTING:
            gl.glEnable(gl.GL_LIGHTING)
            gl.glLightfv(gl.GL_LIGHT1, gl.GL_POSITION, light1_position)
            gl.glLightfv(gl.GL_LIGHT2, gl.GL_POSITION, light2_position)
            gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, (1.0, 1.0, 1.0, 1.0))
        gl.glColor3f(1.0, 1.0, 1.0)

        # gloss_list = []
        # reflections = []
        # glColor3f(1.0, 1.0, 1.0)

        fs_emu_texturing(True)
        fs_emu_blending(False)

        for item_index in list(yield_render_item_sequence()):

            if num_items < MIN_WRAPAROUND_ITEMS:
                if not (
                    0
                    <= item_index - (i_position // num_items * num_items)
                    < num_items
                ):
                    continue

            rel_index = item_index - position  # selected

            distance = abs(rel_index)
            # strength = 1.0

            gl.glPushMatrix()

            pos, rotation = get_item_position(rel_index)

            gl.glTranslate(*pos)
            scale = 1.0
            area = 0.9

            item = menu[item_index % num_items]
            height = math.sqrt(area / item.ratio)
            width = item.ratio * height

            if rel_index <= 0.0:
                spec = 0.8
            elif rel_index > 1.0:
                spec = 0.05
            else:
                spec = 0.8 - rel_index / 1.0 * 0.75
            if LIGHTING:
                gl.glMaterialfv(
                    gl.GL_FRONT, gl.GL_SPECULAR, (spec, spec, spec, 1.0)
                )

            gl.glRotate(rotation, 0.0, 1.0, 0.0)

            item.render(width, height)

            if not LIGHTING:
                if distance < 1.0:
                    gloss_alpha = 0.25 + distance * 0.25
                else:
                    gloss_alpha = 0.5
                render_item_gloss(gloss_alpha, ratio=item.ratio, area=area)
            gl.glPopMatrix()
            item_data.append(
                (
                    "ITEM",
                    menu,
                    item_index,
                    pos,
                    rotation,
                    scale,
                    item.ratio,
                    1.0,
                    area,
                )
            )

            # reflections.append((item, pos, rotation,
            # width, height, spec * 0.3))

        if not center_item:
            State.get().center_item = None

        if LIGHTING:
            light1_position[1] = -light1_position[1]
            light2_position[1] = -light2_position[1]
            gl.glLightfv(gl.GL_LIGHT1, gl.GL_POSITION, light1_position)
            gl.glLightfv(gl.GL_LIGHT2, gl.GL_POSITION, light2_position)
            # glLightfv(GL_LIGHT1, GL_POSITION, (-5.0, -1.5, 1.2, 1.0))
            # glLightfv(GL_LIGHT2, GL_POSITION, (-0.5, -5.0, 1.2, 1.0))
            gl.glMaterialfv(gl.GL_FRONT, gl.GL_DIFFUSE, (0.3, 0.3, 0.3, 0.0))

        # glColor3f(0.3, 0.3, 0.3)
        # for item, pos, rotation, width, height, spec in reflections:
        #     #if LIGHTING:
        #     #    glMaterialfv(GL_FRONT, GL_SPECULAR, (spec, spec, spec, 1.0))
        #     #else:
        #     #    glColor4f(0.33, 0.33, 0.33, 0.33)
        #     #    fs_emu_blending(True)
        #     glPushMatrix()
        #     glTranslate(*pos)
        #     glRotate(rotation, 0.0, 1.0, 0.0)
        #     item.render(width, height, reflection=True)
        #     glPopMatrix()

        if LIGHTING:
            gl.glDisable(gl.GL_LIGHTING)

    return item_data
Beispiel #15
0
    def render(self, transition=1.0):
        Render.get().hd_perspective()

        # w = 560
        # h = 92
        # x = 1920 - w * transition
        # y = 1080 - 60 - h
        # y = 1080 - 60 - h - 44
        # z = -0.9

        item_top = 1080 - 90
        item_left = 1920 - 560 + 40

        item_left += Texture.sidebar_background_shadow.w * (
            1.0 - transition)

        gl.glPushMatrix()
        gl.glTranslate(0.0, 0.0, 0.7)
        # glTranslated((1.0 - transition) * g_tex_sidebar_background->width,
        # 0, 0)
        # fs_emu_set_texture(g_tex_sidebar_background)
        # fs_emu_render_texture_with_size(g_tex_sidebar_background,
        #         1920 - g_tex_sidebar_background->width,
        #         0, g_tex_sidebar_background->width,
        #         g_tex_sidebar_background->height)
        # fs_emu_render_sidebar()
        fs_emu_blending(True)
        fs_emu_texturing(True)
        gl.glDepthMask(False)
        Texture.sidebar_background_shadow.render(
            1920 - Texture.sidebar_background_shadow.w * transition,
            0, Texture.sidebar_background_shadow.w,
            Texture.sidebar_background_shadow.h)
        gl.glDepthMask(True)
        gl.glPopMatrix()

        # x = x + 70
        # w = w - 70
        x = item_left
        y = item_top - 60
        w = 560 - 40 - 40
        h = 60

        for i, item in enumerate(self.items):
            if item.group:
                if i > 0:
                    # skip one half row before group heading
                    y -= h / 2
            selected = i == self.index and State.get().navigatable == self
            z = 0.71
            fs_emu_texturing(False)

            if selected:
                fg_color = [1.0, 1.0, 1.0, 1.0]
                gl.glBegin(gl.GL_QUADS)

                gl.glColor3f(0.00, 0x99 / 0xff, 0xcc / 0xff)
                gl.glVertex3f(x, y + 4, z)
                gl.glVertex3f(x + w, y + 4, z)
                gl.glVertex3f(x + w, y + h - 4, z)
                gl.glVertex3f(x, y + h - 4, z)
                # glColor3f(0.6, 0.6, 0.6)
                # glVertex3f(x, y + 4, z)
                # glVertex3f(x + w, y + 4, z)
                # glVertex3f(x + w, y + h, z)
                # glVertex3f(x, y + h, z)
                gl.glEnd()
            else:
                fg_color = [1.0, 1.0, 1.0, 1.0]

            # glBegin(GL_QUADS)
            # glColor3f(0.4, 0.4, 0.4)
            # glVertex3f(x, y, z)
            # glVertex3f(x + w, y, z)
            # glVertex3f(x + w, y + 4, z)
            # glVertex3f(x, y + 4, z)
            # glEnd()
            # fs_emu_texturing(True)

            if i > 0:
                fg_color[3] *= 0.35

            text = item.title

            # FIXME: REMOVE
            # fs_emu_blending(False)
            # fs_emu_blending(True)

            gl.glDisable(gl.GL_DEPTH_TEST)
            if item.group:
                BitmapFont.menu_font.render(
                    text, x + 20, y + 14, r=0.0, g=0x99 / 0xff, b=0xcc / 0xff)
            else:
                BitmapFont.menu_font.render(text, x + 20, y + 14)
            gl.glEnable(gl.GL_DEPTH_TEST)
            # text = item.title.upper()
            # tw, th = Render.get().text(text, Font.main_path_font,
            #         x + 40, y + 43, color=fg_color)
            # text = item.subtitle.upper()
            # fg_color[3] = fg_color[3] * 0.4
            # text = item.title.upper()
            # tw, th = Render.get().text(text, Font.list_subtitle_font,
            #         x + 40, y + 18, color=fg_color)
            y -= h