Пример #1
0
def color_region(request, graphics_pipe):
    """Creates and returns a DisplayRegion with a depth buffer."""

    engine = core.GraphicsEngine()
    engine.set_threading_model("")

    # Vulkan needs no host window.
    if graphics_pipe.get_interface_name() != "Vulkan":
        host_fbprops = core.FrameBufferProperties()
        host_fbprops.force_hardware = True

        host = engine.make_output(
            graphics_pipe,
            'host',
            0,
            host_fbprops,
            core.WindowProperties.size(32, 32),
            core.GraphicsPipe.BF_refuse_window,
        )
        engine.open_windows()

        if host is None:
            pytest.skip("GraphicsPipe cannot make offscreen buffers")

        host_gsg = host.gsg
    else:
        host = None
        host_gsg = None

    fbprops = core.FrameBufferProperties()
    fbprops.force_hardware = True
    fbprops.set_rgba_bits(8, 8, 8, 8)
    fbprops.srgb_color = request.param

    buffer = engine.make_output(
        graphics_pipe,
        'buffer',
        0,
        fbprops,
        core.WindowProperties.size(32, 32),
        core.GraphicsPipe.BF_refuse_window,
        host_gsg,
        host
    )
    engine.open_windows()

    if buffer is None:
        pytest.skip("Cannot make color buffer")

    if fbprops.srgb_color != buffer.get_fb_properties().srgb_color:
        pytest.skip("Cannot make buffer with required srgb_color setting")

    buffer.set_clear_color_active(True)
    buffer.set_clear_color((0, 0, 0, 1))

    yield buffer.make_display_region()

    if buffer is not None:
        engine.remove_window(buffer)
Пример #2
0
def depth_region(request, graphics_pipe):
    """Creates and returns a DisplayRegion with a depth buffer."""

    engine = core.GraphicsEngine()
    engine.set_threading_model("")

    # Vulkan needs no host window.
    if graphics_pipe.get_interface_name() != "Vulkan":
        host_fbprops = core.FrameBufferProperties()
        host_fbprops.force_hardware = True

        host = engine.make_output(
            graphics_pipe,
            'host',
            0,
            host_fbprops,
            core.WindowProperties.size(32, 32),
            core.GraphicsPipe.BF_refuse_window,
        )
        engine.open_windows()

        if host is None:
            pytest.skip("GraphicsPipe cannot make offscreen buffers")

        host_gsg = host.gsg
    else:
        host = None
        host_gsg = None

    fbprops = core.FrameBufferProperties()
    fbprops.force_hardware = True
    fbprops.depth_bits = request.param

    if fbprops.depth_bits >= 32:
        fbprops.float_depth = True

    buffer = engine.make_output(graphics_pipe, 'buffer', 0, fbprops,
                                core.WindowProperties.size(32, 32),
                                core.GraphicsPipe.BF_refuse_window, host_gsg,
                                host)
    engine.open_windows()

    if buffer is None:
        pytest.skip("Cannot make depth buffer")

    if buffer.get_fb_properties().depth_bits != request.param:
        pytest.skip("Could not make buffer with desired bit count")

    yield buffer.make_display_region()

    if buffer is not None:
        engine.remove_window(buffer)
Пример #3
0
    def __init__(self):
        self.engine = p3d.GraphicsEngine()

        gps = p3d.GraphicsPipeSelection.get_global_ptr()
        self.pipe = gps.make_module_pipe('pandagl')

        self.view_lens = p3d.MatrixLens()
        self.view_camera = p3d.NodePath(p3d.Camera('view'))
        self.view_camera.node().set_lens(self.view_lens)
        self.view_camera.node().set_active(True)
        self._make_offscreen(1, 1)

        self.converter = None
        self.render = None
        self.render_manager = None
Пример #4
0
def engine(pipe):
    return p3d.GraphicsEngine(pipe)