def render_me(self): glColor3f(1, 1, 1) glLoadIdentity() glTranslate(self.position[0], self.position[1], self.position[2]) glutSolidCube(self.side_size) glLoadIdentity()
def paintCells(self): size = 0.0855 * self.cl / 3. for i, p in enumerate(self.positions): color = (1., 0., 0.) if i == self.activeCell else (0., 0., 1.) glColor3fv(color) glPushMatrix() offs = np.array([p[0], p[2], p[1]]) / 35. + self.offsets glTranslatef(*offs.tolist()) glutSolidCube(size) glPopMatrix()
def draw(self, from_fixed_frame: bool = True): self.opgl_move_to_pose(from_fixed_frame) self.apply_material() # draw parallelepiped quad = gluNewQuadric() gluQuadricDrawStyle(quad, GLU_FILL) gluQuadricTexture(quad, True) gluQuadricNormals(quad, GLU_SMOOTH) glScalef(self.length, self.width, self.height) glutSolidCube(1)
def draw( self ): """draw a cube using glut solid cube """ # save current matrix glPushMatrix() # set material glMaterialfv( GL_FRONT, GL_SPECULAR, self.specular ) glMaterialfv( GL_FRONT, GL_SHININESS, self.shininess ) glMaterialfv( GL_FRONT, GL_DIFFUSE, self.diffuse ) # move to centroid glTranslatef( *self.centroid ) # draw cube glutSolidCube( self.size ) # restore matrix glPopMatrix()
def _cube_(self, radius=1): ''' ''' glutSolidCube(radius)
def _occlusionRender(self): """Do the low-level rendering of the occlusion volume""" glTranslate(*self.center) glScale(*self.size) glutSolidCube(1.0)
def display(self): glLoadIdentity() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) gluLookAt(self.cam_pos.x, self.cam_pos.y, self.cam_pos.z, self.cam_focus.x, self.cam_focus.y, self.cam_focus.z, 0, 1, 0) self.level.draw() glLoadIdentity() gluLookAt(0, -0.5, 2.5, 0, 0, 0, 0, 1, 0) wdth = 0.3 glTranslate( 0.0 - (len(self.level.solomon.current_state.keys()) - 1) * wdth / 2.0, -1.3, 0) if debug == True: for k in self.level.solomon.current_state.keys(): col = "red" if self.level.solomon.current_state[k]: col = "green" glMaterialfv(GL_FRONT, GL_DIFFUSE, colours[col]) glutSolidCube(wdth - 0.02) glTranslate(wdth, 0, 0) glPushMatrix() #glLoadIdentity() glScale(0.005, 0.01, -0.01) glTranslate(-90, 4, -20) #glTranslate(-180,-70,0) glTranslate(-wdth, 0, 0) self.letters.drawString(k[:4]) glPopMatrix() glLoadIdentity() gluLookAt(0, -0.5, 2.5, 0, 0, 0, 0, 1, 0) wdth = 0.2 joystick_actions = [x for x in dir(self.joystick) if x[0:2] == "is"] glTranslate(0.0 - (len(joystick_actions) - 1) * wdth / 2.0, -1.0, 0) if debug == True: for k in joystick_actions: #print(k) col = "red" if getattr(self.joystick, k)(self.keys): col = "green" glMaterialfv(GL_FRONT, GL_DIFFUSE, colours[col]) glutSolidCube(wdth - 0.02) glTranslate(wdth, 0, 0) glPushMatrix() #glLoadIdentity() glScale(0.005, 0.01, -0.01) glTranslate(-45, 0, -20) #glTranslate(-180,-70,0) glTranslate(-wdth, 0, 0) self.letters.drawString(k[2:4]) glPopMatrix() glLoadIdentity() gluLookAt(0, 0, 2.5, 0, 0, 0, 0, 1, 0) glScale(0.01, 0.01, -0.01) glTranslate(-180, -70, 0) if debug == True: self.letters.drawString('X:' + str(self.level.solomon.x) + ' Y:' + str(self.level.solomon.y)) glTranslate(0, 0 - 15, 0) gx, gy = int(self.level.solomon.x), int(self.level.solomon.y) self.letters.drawString('G {0} on: {1} below: {2}'.format( str((gx, gy)), self.level.grid[gy][gx], self.level.grid[gy - 1][gx])) glTranslate(0, 0 - 15, 0) self.letters.drawString('') glutSwapBuffers()