in renderer/glViewer.py [0:0]
def renderscene():
global g_xRotate, g_rotateView_counter, g_saveFrameIdx
start = timeit.default_timer()
# global xrot
# global yrot
# global view_dist
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
#Some anti-aliasing code (seems not working, though)
glEnable (GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glEnable (GL_LINE_SMOOTH)
glHint (GL_LINE_SMOOTH_HINT, GL_NICEST)
# glEnable(GL_POLYGON_SMOOTH)
glEnable(GL_MULTISAMPLE)
# glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST)
# Set up viewing transformation, looking down -Z axis
glLoadIdentity()
#gluLookAt(0, 0, -g_fViewDistance, 0, 0, 0, -.1, 0, 0) #-.1,0,0
gluLookAt(0,0,0, 0, 0, 1, 0, -1, 0)
if g_viewMode=='camView': #Set View Point in MTC Camera View
# camidlist = ''.join(g_camid)
# camid = int(camidlist)
if g_bOrthoCam:
setCameraViewOrth()
else:
setCameraView()
else:#Free Mode
# Set perspective (also zoom)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
#gluPerspective(zoom, float(g_Width)/float(g_Height), g_nearPlane, g_farPlane)
gluPerspective(65, float(g_Width)/float(g_Height), g_nearPlane, g_farPlane) # This should be called here (not in the reshpe)
glMatrixMode(GL_MODELVIEW)
# Render the scene
# setFree3DView()
glTranslatef(0,0,g_zoom)
glRotatef( -g_yRotate, 1.0, 0.0, 0.0)
glRotatef( -g_xRotate, 0.0, 1.0, 0.0)
glRotatef( g_zRotate, 0.0, 0.0, 1.0)
# glutSolidSphere(3, 10, 10) #Draw Origin
glTranslatef( g_xTrans, 0.0, 0.0 )
glTranslatef( 0.0, g_yTrans, 0.0)
glTranslatef( 0.0, 0, g_zTrans)
glColor3f(0,1,0)
#This should be drawn first, without depth test (it should be always back)
if g_bShowBackground:
if g_bOrthoCam:
DrawBackgroundOrth()
else:
DrawBackground()
glEnable(GL_LIGHTING)
glEnable(GL_CULL_FACE)
#drawbody(bodyDatas[cur_ind], connMat_coco19)
#drawbody_haggling(m_landmarks[:, cur_ind], connMat_coco19)
#if g_bSaveToFile:
# #Debug
# glColor3f(1,0,0)
# glutSolidTeapot(100, 10, 10)
# RenderDomeFloor()
# glutSwapBuffers()
# return
# glUseProgram(0)
glPolygonMode(GL_FRONT, GL_FILL)
glPolygonMode(GL_BACK, GL_FILL)
if g_bShowSkeleton:
DrawSkeletons()
# DrawSkeletonsGT()
DrawTrajectory()
DrawFaces()
DrawHands()
if g_bShowMesh:
DrawMeshes()
DrawPosOnly()
glDisable(GL_LIGHTING)
glDisable(GL_CULL_FACE)
DrawCameras()
if g_ptCloud is not None:
DrawPtCloud()
if g_bShowFloor:
RenderDomeFloor()
global g_frameIdx#, g_frameLimit
global g_fps, g_show_fps
if g_show_fps:
RenderText("{0} fps".format(int(np.round(g_fps,0))))
# swap the screen buffers for smooth animation
glutSwapBuffers()
if g_bRotateView:
# g_rotateInnterval = 2.0
g_xRotate += g_rotateInterval
# print("{0}/rotview_{1:04d}.jpg".format("RENDER_DIR",g_rotateView_counter))
g_saveFrameIdx = g_rotateView_counter
g_rotateView_counter+=1
if g_bSaveToFile:
SaveScenesToFile()
g_frameIdx +=1
#time.sleep(1)
if g_frameIdx>=g_frameLimit:
#global g_bSaveOnlyMode
if g_bSaveOnlyMode:
#exit opengl
global g_stopMainLoop
g_stopMainLoop= True
g_frameIdx = 0
else:
g_frameIdx =0
if False:
#Ensure 30fps
stop = timeit.default_timer()
time_sec = stop - start
sleepTime = 0.03333*10 -time_sec
if sleepTime>0:
time.sleep(sleepTime)