Esempio n. 1
0
    def __init__(self, width, height, mesh_file):
        self.events = []
        self.play = False

        surrender.init(width, height)
        aspect = HEIGHT / float(WIDTH)
        self.projection_mat = matlib.Mat()
        self.projection_mat.persp(50, 1.0 / aspect, 1, 100)

        self.modelview_mat = matlib.Mat()
        self.modelview_mat.lookat(
            matlib.Vec(20, 20, 20),
            matlib.Vec(0, 0, 0),
            matlib.Vec(0, 1, 0))

        self.transform_mat = matlib.Mat()

        glClearColor(0.3, 0.3, 0.3, 1.0)
        glEnable(GL_DEPTH_TEST)
        glEnable(GL_CULL_FACE)
        glCullFace(GL_BACK)

        self.load(mesh_file)
Esempio n. 2
0
    def __init__(self, config):
        """Constructor.

        Instantiates a window and sets up an OpenGL context for it, which is
        immediately made active, using the given configuration data.

        :param config: Renderer-specific configuration.
        :type config: mapping-like interface.
        """
        try:
            width = int(config['width'])
            height = int(config['height'])
            gl_major, gl_minor = [
                int(v) for v in config.get('openglversion', '3.3').split('.')
            ]
        except (KeyError, TypeError, ValueError) as err:
            raise ConfigError(err)

        surrender.init(width, height)

        self._width = width
        self._height = height
        self.gl_setup(width, height)
        self.render_queue = []