def on_draw(self): # Clear the window with the current clearing color glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) transformationMatrix = M3DMatrix44f() # Build a rotation matrix m3dRotationMatrix44(transformationMatrix, m3dDegToRad(yRot), 0.0, 1.0, 0.0) transformationMatrix[12] = 0.0 transformationMatrix[13] = 0.0 transformationMatrix[14] = -2.5 DrawTorus(transformationMatrix)
def on_draw(self): # Clear the window with the current clearing color glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) transformationMatrix = M3DMatrix44f() # Build a rotation matrix m3dRotationMatrix44(transformationMatrix, m3dDegToRad(yRot), 0.0, 1.0, 0.0) transformationMatrix[12] = 0.0 transformationMatrix[13] = 0.0 transformationMatrix[14] = -2.5 glLoadMatrixf(transformationMatrix) gltDrawTorus(0.35, 0.15, 40, 20)
def DrawGLScene(): # Clear the window with the current clearing color glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) transformationMatrix = M3DMatrix44f() # Build a rotation matrix m3dRotationMatrix44(transformationMatrix, m3dDegToRad(yRot), 0.0, 1.0, 0.0) transformationMatrix[12] = 0.0 transformationMatrix[13] = 0.0 transformationMatrix[14] = -2.5 DrawTorus(transformationMatrix) glutSwapBuffers()
def RotateLocalY(self, fAngle): # Just Rotate around the up vector # Create a rotation matrix around my Up (Y) vector rotMat = M3DMatrix44f() m3dRotationMatrix44(rotMat, fAngle, self.vUp[0], self.vUp[1], self.vUp[2]) newVect = M3DVector3f() # Rotate forward pointing vector (inlined 3x3 transform) newVect[0] = rotMat[0] * self.vForward[0] + rotMat[4] * self.vForward[1] + rotMat[8] * self.vForward[2] newVect[1] = rotMat[1] * self.vForward[0] + rotMat[5] * self.vForward[1] + rotMat[9] * self.vForward[2] newVect[2] = rotMat[2] * self.vForward[0] + rotMat[6] * self.vForward[1] + rotMat[10] * self.vForward[2] self.vForward[0] = newVect[0] self.vForward[1] = newVect[1] self.vForward[2] = newVect[2]
def RotateLocalY(self, fAngle): # Just Rotate around the up vector # Create a rotation matrix around my Up (Y) vector rotMat = M3DMatrix44f() m3dRotationMatrix44(rotMat, fAngle, self.vUp[0], self.vUp[1], self.vUp[2]) newVect = M3DVector3f() # Rotate forward pointing vector (inlined 3x3 transform) newVect[0] = rotMat[0] * self.vForward[0] + rotMat[4] * self.vForward[ 1] + rotMat[8] * self.vForward[2] newVect[1] = rotMat[1] * self.vForward[0] + rotMat[5] * self.vForward[ 1] + rotMat[9] * self.vForward[2] newVect[2] = rotMat[2] * self.vForward[0] + rotMat[6] * self.vForward[ 1] + rotMat[10] * self.vForward[2] self.vForward[0] = newVect[0] self.vForward[1] = newVect[1] self.vForward[2] = newVect[2]