Beispiel #1
0
 def set_perspective(self, fovy):
     '''
     Set perspective projection
     '''
     aspect = self.width / self.height
     zNear = 0.1
     zFar = 1000.0
     gl.glMatrixMode(gl.GL_PROJECTION)
     gl.glLoadIdentity()
     glu.gluPerspective(fovy, aspect, zNear, zFar);
Beispiel #2
0
 def clear_and_setup_window(self):
     gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
     gl.glMatrixMode(gl.GL_PROJECTION)  # Select The Projection Matrix
     gl.glLoadIdentity()  # Reset The Projection Matrix
     field_of_view_y = 100
     aspect_ratio = self.window.width if self.window.height == 0 else self.window.width / self.window.height
     z_clip_near = 0.1
     z_clip_far = 1000.0
     glu.gluPerspective(field_of_view_y, aspect_ratio, z_clip_near,
                        z_clip_far)
Beispiel #3
0
        def on_resize(width, height):
            # sets the viewport
            gl.glViewport(0, 0, width, height)

            # sets the projection
            gl.glMatrixMode(gl.GL_PROJECTION)
            gl.glLoadIdentity()
            glu.gluPerspective(60.0, width / float(height), 0.1, 100.0)

            # sets the model view
            gl.glMatrixMode(gl.GL_MODELVIEW)
            gl.glLoadIdentity()

            return pyglet.event.EVENT_HANDLED
Beispiel #4
0
        def on_resize(width, height):
            # sets the viewport
            gl.glViewport(0, 0, width, height)

            # sets the projection
            gl.glMatrixMode(gl.GL_PROJECTION)
            gl.glLoadIdentity()
            glu.gluPerspective(90, width / float(height), 0.1, 2*self.depth)

            # sets the model view
            gl.glMatrixMode(gl.GL_MODELVIEW)
            gl.glLoadIdentity()

            return pyglet.event.EVENT_HANDLED
Beispiel #5
0
        def on_resize(width, height):
            # sets the viewport
            gl.glViewport(0, 0, width, height)

            # sets the projection
            gl.glMatrixMode(gl.GL_PROJECTION)
            gl.glLoadIdentity()
            # gluPerspective(vfov, aspect, near_clipping, far_clipping)
            glu.gluPerspective(90.0, width / height, 0.1, 10000.0)

            # sets the model view
            gl.glMatrixMode(gl.GL_MODELVIEW)
            gl.glEnable(gl.GL_DEPTH_TEST)
            gl.glLoadIdentity()

            return pyglet.event.EVENT_HANDLED