def setup_geom(self):
     """Move to pos, turn by angle and scale by scale"""
     super(ScalePart,self).setup_geom()
     scale=self.scale
     if scale and scale != 1:
         glEnable(GL_NORMALIZE)
         glScalef(scale,scale,scale)
 def setup_geom(self):
     """Move to pos, turn by angle and scale by scale"""
     super(ScalePart, self).setup_geom()
     scale = self.scale
     if scale and scale != 1:
         glEnable(GL_NORMALIZE)
         glScalef(scale, scale, scale)
Example #3
0
 def setup_geom(self):
     """Move to pos, turn by angle and scale by scale"""
     super(ScalePart, self).setup_geom()
     scale = self.scale
     if scale and scale != 1:
         if isinstance(scale, (int, float)):
             sx, sy, sz = scale, scale, scale
         else:
             sx, sy, sz = scale
         glEnable(GL_NORMALIZE)
         glScalef(sx, sy, sz)
Example #4
0
transformation_location = gl.glGetUniformLocation(shader_program,
                                                  "transformation")

# Get the view location
view_location = gl.glGetUniformLocation(shader_program, "view")

# Get the projection location
projection_location = gl.glGetUniformLocation(shader_program, "projection")

# Get the color location
color_location = gl.glGetUniformLocation(shader_program, "color")

# Configure GL -----------------------------------------------------------------------|

# Enable depth test
gl.glEnable(gl.GL_DEPTH_TEST)

# Accept fragment if it is closer to the camera than the former one
gl.glDepthFunc(gl.GL_LESS)

# Create Camera and Game Objects -----------------------------------------------------|

perspective_projection = glm.perspective(glm.radians(45.0),
                                         screen_size.x / screen_size.y, 0.1,
                                         100.0)

camera = Camera(position=glm.vec3(4.0, 30.0, -40.0), target=glm.vec3(0.0))

player = (GameObject(position=glm.vec3(0, 0, -10),
                     scale=glm.vec3(1),
                     color=glm.vec3(0.5, 0.5, 0.0)))