Example #1
0
File: Draw.py Project: d11/rts
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)
Example #2
0
File: Draw.py Project: d11/rts
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()
Example #3
0
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)
Example #4
0
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()
Example #5
0
File: Draw.py Project: d11/rts
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")
Example #6
0
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")
Example #7
0
 def clockErrorExit(self):
     SteerTest.errorExit("Problem reading system clock.\n")
Example #8
0
 def advanceSimulationTime(self, seconds):
     if (seconds < 0):
         SteerTest.errorExit("negative arg to advanceSimulationTime.")
     else:
         self.newAdvanceTime += seconds
Example #9
0
	def clockErrorExit(self):
		SteerTest.errorExit("Problem reading system clock.\n")
Example #10
0
	def advanceSimulationTime(self, seconds):
	    if (seconds < 0):
	        SteerTest.errorExit("negative arg to advanceSimulationTime.")
	    else:
	        self.newAdvanceTime += seconds;
Example #11
0
File: Draw.py Project: d11/rts
def warnIfInUpdatePhase2(name):
    message= "use annotation (during simulation update, do not call %s)" % (name)
    SteerTest.printWarning (message);
Example #12
0
def warnIfInUpdatePhase2(name):
    message = "use annotation (during simulation update, do not call %s)" % (
        name)
    SteerTest.printWarning(message)