def checkForGLError(locationDescription): """OpenGL-specific routine for error check, report, and exit""" # normally (when no error) just return lastGlError = glGetError() if (lastGlError == GL_NO_ERROR): return # otherwise print vaguely descriptive error message, then exit if lastGlError==GL_INVALID_ENUM: errStr = "GL_INVALID_ENUM" elif lastGlError==GL_INVALID_VALUE: errStr = "GL_INVALID_VALUE" elif lastGlError==GL_INVALID_OPERATION: errStr = "GL_INVALID_OPERATION" elif lastGlError==GL_STACK_OVERFLOW: errStr = "GL_STACK_OVERFLOW" elif lastGlError==GL_STACK_UNDERFLOW: errStr = "GL_STACK_UNDERFLOW" elif lastGlError==GL_OUT_OF_MEMORY: errStr = "GL_OUT_OF_MEMORY" elif lastGlError==GL_TABLE_TOO_LARGE: errStr = "GL_TABLE_TOO_LARGE" if (locationDescription!=None & locationDescription!=""): ld = " in " +locationDescription else: ld = "" print "SteerTest: OpenGL error ", errStr, ld SteerTest.exit(1)
def displayFunc(): """ Main drawing function for SteerTest application, drives simulation as a side effect""" # clear color and depth buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # run simulation and draw associated graphics SteerTest.updateSimulationAndRedraw () # draw text showing (smoothed, rounded) "frames per second" rate #drawDisplayFPS (); # draw the name of the selected PlugIn drawDisplayPlugInName () # draw the name of the camera's current mode drawDisplayCameraModeName () # draw crosshairs to indicate aimpoint (xxx for debugging only?) drawReticle () # check for errors in drawing module, if so report and exit # checkForDrawError ("SteerTest::updateSimulationAndRedraw") # double buffering, swap back and front buffers glFlush () glutSwapBuffers()
def checkForGLError(locationDescription): """OpenGL-specific routine for error check, report, and exit""" # normally (when no error) just return lastGlError = glGetError() if (lastGlError == GL_NO_ERROR): return # otherwise print vaguely descriptive error message, then exit if lastGlError == GL_INVALID_ENUM: errStr = "GL_INVALID_ENUM" elif lastGlError == GL_INVALID_VALUE: errStr = "GL_INVALID_VALUE" elif lastGlError == GL_INVALID_OPERATION: errStr = "GL_INVALID_OPERATION" elif lastGlError == GL_STACK_OVERFLOW: errStr = "GL_STACK_OVERFLOW" elif lastGlError == GL_STACK_UNDERFLOW: errStr = "GL_STACK_UNDERFLOW" elif lastGlError == GL_OUT_OF_MEMORY: errStr = "GL_OUT_OF_MEMORY" elif lastGlError == GL_TABLE_TOO_LARGE: errStr = "GL_TABLE_TOO_LARGE" if (locationDescription != None & locationDescription != ""): ld = " in " + locationDescription else: ld = "" print "SteerTest: OpenGL error ", errStr, ld SteerTest.exit(1)
def displayFunc(): """ Main drawing function for SteerTest application, drives simulation as a side effect""" # clear color and depth buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) # run simulation and draw associated graphics SteerTest.updateSimulationAndRedraw() # draw text showing (smoothed, rounded) "frames per second" rate #drawDisplayFPS (); # draw the name of the selected PlugIn drawDisplayPlugInName() # draw the name of the camera's current mode drawDisplayCameraModeName() # draw crosshairs to indicate aimpoint (xxx for debugging only?) drawReticle() # check for errors in drawing module, if so report and exit # checkForDrawError ("SteerTest::updateSimulationAndRedraw") # double buffering, swap back and front buffers glFlush() glutSwapBuffers()
def drawCameraLookAtCheck (cameraPosition,pointToLookAt,up): """this comes up often enough to warrant its own warning function""" view = pointToLookAt - cameraPosition perp = view.perpendicularComponent (up) # LP: is this a test for object equality or for containin data if (perp == vector.zero): SteerTest.printWarning ("LookAt: degenerate camera")
def drawCameraLookAtCheck(cameraPosition, pointToLookAt, up): """this comes up often enough to warrant its own warning function""" view = pointToLookAt - cameraPosition perp = view.perpendicularComponent(up) # LP: is this a test for object equality or for containin data if (perp == vector.zero): SteerTest.printWarning("LookAt: degenerate camera")
def clockErrorExit(self): SteerTest.errorExit("Problem reading system clock.\n")
def advanceSimulationTime(self, seconds): if (seconds < 0): SteerTest.errorExit("negative arg to advanceSimulationTime.") else: self.newAdvanceTime += seconds
def advanceSimulationTime(self, seconds): if (seconds < 0): SteerTest.errorExit("negative arg to advanceSimulationTime.") else: self.newAdvanceTime += seconds;
def warnIfInUpdatePhase2(name): message= "use annotation (during simulation update, do not call %s)" % (name) SteerTest.printWarning (message);
def warnIfInUpdatePhase2(name): message = "use annotation (during simulation update, do not call %s)" % ( name) SteerTest.printWarning(message)