def draw(self): self.update() glPushMatrix() #glDisable(GL_COLOR_MATERIAL) #glDisable(GL_LIGHTING) light = glIsEnabled(GL_LIGHTING) if not light: glEnable(GL_LIGHTING) glColor3f(1.0, 1.0, 0.0) glRotatef(60.0, 0.0, 1.0, 0.0) glScalef(0.1, 0.1, 0.1) glTranslatef(self.x, self.y, 0.0) #glPushMatrix() #glLightfv(GL_LIGHT0, GL_POSITION, (self.x, self.y, 0.0, 10000.0) ) #glLightfv(GL_LIGHT1, GL_POSITION, (1.0, 1.0, 0.0, 0.0) ) #glLightfv(GL_LIGHT1, GL_AMBIENT, (0.0, 0.0, 0.0, 1.0) ) #glLightfv(GL_LIGHT1, GL_DIFFUSE, (1.0, 1.0, 1.0, 1.0) ) glLightfv(GL_LIGHT1, GL_POSITION, (0.0, 0.0, 0.0, 1.0)) glLightfv(GL_LIGHT1, GL_AMBIENT, (0.5, 0.5, 0.5, 1.0)) glLightfv(GL_LIGHT1, GL_AMBIENT, (0.0, 0.0, 0.0, 1.0)) glLightfv(GL_LIGHT1, GL_DIFFUSE, (0.3, 0.3, 0.2, 1.0)) #glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, 180) #glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, (1.0, 1.0, 1.0)) #glPopMatrix() #glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0) glMaterialfv(GL_FRONT, GL_EMISSION, (0.3, 0.1, 0.0, 1.0)) #glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, (0.5, 0.5, 0.0, 1.0)) #glMaterialfv(GL_FRONT, GL_DIFFUSE, (1.0, 1.0, 1.0, 1.0)) #glMaterialfv(GL_FRONT, GL_AMBIENT, (0.0, 0.0, 0.0, 1.0)) #glMaterialfv(GL_FRONT, GL_DIFFUSE, (0.0, 0.0, 0.0, 1.0)) graphics.drawVBO(self.verticesId, self.normalsId, self.vertexCount) glMaterialfv(GL_FRONT, GL_EMISSION, (0.0, 0.0, 0.0, 1.0)) #glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (0.0, 0.0, 0.0, 1.0)) if not light: glDisable(GL_LIGHTING) glPopMatrix()
def draw(self): glPushMatrix() glDisable(GL_LIGHTING) glScalef(10.0, 10.0, 10.0) glTranslatef(0.0, -20.0, 0.0) now = time.gmtime() if now.tm_hour > 6 and now.tm_hour < 18: self.sun.draw() brightness = \ ((15 * (now.tm_hour - 6) + \ 0.25*now.tm_min) * (3.1415/180.0)) / 6.28 texCoordsId = self.texCoordsId textureId = self.textureId else: self.moon.draw() brightness = 1.0 texCoordsId = self.nightTexCoordsId textureId = self.nightTextureId glColor3f(brightness, brightness, brightness) #glDisable(GL_DEPTH_TEST) glBindTexture(GL_TEXTURE_2D, textureId) glEnable(GL_TEXTURE_2D) graphics.drawVBO(self.verticesId, self.normalsId, self.vertexCount, texCoordsId) glDisable(GL_TEXTURE_2D) #glEnable(GL_DEPTH_TEST) light = glIsEnabled(GL_LIGHTING) if not light: glEnable(GL_LIGHTING) if not light: glDisable(GL_LIGHTING) glEnable(GL_LIGHTING) glPopMatrix()
def draw(self): glPushMatrix() glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (0.6, 0.6, 1.0, 1.0)) glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (0.6, 0.6, 1.0, 1.0)) glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (1.0, 1.0, 1.0, 1.0)) glTranslatef(-1000.0, -40.0, -1000.0) glScalef(20.0, 8.0, 20.0) glUseProgramObjectARB(self.program) loc = glGetUniformLocation(self.program,'time') glUniform1f(loc, time.time() % 360) graphics.drawVBO(self.verticesId, self.normalsId, self.vertexCount) glUseProgramObjectARB(0) glPopMatrix()
def draw(self): glPushMatrix() # glDisable(GL_COLOR_MATERIAL) # glDisable(GL_LIGHTING) light = glIsEnabled(GL_LIGHTING) if not light: glEnable(GL_LIGHTING) glColor3f(1.0, 0.0, 0.0) glTranslatef(self.data.position[0], self.data.position[1], self.data.position[2]) glRotatef(self.data.orientation[1], 0.0, 1.0, 0.0) graphics.drawVBO(self.verticesId, self.normalsId, self.vertexCount) if not light: glDisable(GL_LIGHTING) glPopMatrix()