⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tdw_stereo_multi.conf

📁 集群计算环境下的网络通讯与负载系统
💻 CONF
字号:
# Copyright (c) 2001, Stanford University# All rights reserved## See the file LICENSE.txt for information on redistributing this software.# Test running a quad-buffered stereo-aware program in a passive stereo# configuration.  Basically, instead of quad-color buffers, we use a tilesort# config with two servers, one for the left eye, one for the right.# This demo runs in two modes:# 1. Native stereo (the default):#      The stereocube demo will be run with the -s option which causes it#      explicitly render left/right views with glDrawBuffer.# 2. Forced stereo (pass in "force" parameter)#      The stereocube demo runs as a normal, non-stereo program.#      The config file here specifies special viewing and projection#      matrices to produce a stereo effect.## Two server windows will open, one for the left eye, one for the right.# By either "defocusing" or crossing your eyes you can see the stere effect.# The default window arrangement is for defocused stereo.# You'll have to swap the default window positions to get cross-eyed stereo.## You may also have to tune the EyeSep (interocular distance) and# default tile/window size.import syssys.path.append( "../server" )from mothership import *import crmatrixFORCE_STEREO = 0#DEMO = "stereocube"#DEMO = "atlantis"#DEMO = "paraview"DEMO = "other"TILE_COLS = 4TILE_ROWS = 3TILE_WIDTH = 1024TILE_HEIGHT = 768RIGHT_TO_LEFT = 0BOTTOM_TO_TOP = 0SERVER_HOSTS=[ 'node1', 'node2', 'node3', 'node4', 'node5', 'node6', 'node7', 'node8', 'node9', 'node10', 'node11', 'node12' ]SideBySide_Offset = 10EyeNames = [ "left", "right" ]DisplayNames = [ ":0.0", ":0.1" ]#EyeNames = [ "right", "left" ]#DisplayNames = [ ":0.1", ":0.0" ]for arg in sys.argv[1:]:	if arg == "-force":		FORCE_STEREO = 1	elif arg[0] != "-":		DEMO = arg		print "--> Note: you may have to tweak the projection parameters!"	else:		print "Unknown option %s" % arg		sys.exit(1)if FORCE_STEREO:	print "--> Forcing %s into stereo mode via config file." % DEMOelse:	print "--> Running %s in conventional stereo mode." % DEMO	if DEMO == "stereocube":	# Parameters copied from sterecube.c demo	if FORCE_STEREO == 0:		DEMO += " -s"	else:		EyeSep = 0.3		Width = 12.0		Hither = 1.0		Yon = 25.0		FocalDist = 5.0elif DEMO == "city":	EyeSep = 0.3	Width = 12.0	Hither = 1.0	Yon = 250.0	FocalDist = 5.0elif DEMO == "atlantis":	# atlantis uses some really big numbers!	# not a great demo for stereo, either.	EyeSep = 0.3	Width = 2000.0	Hither = 10000.0	Yon = 400000.0	FocalDist = Hither * 2.0elif DEMO == "paraview":	# Note: seems to work with "blow.vtk" dataset	EyeSep = 2.0	Width = 40.0	Hither = 120.0	Yon = 180.0	FocalDist = 150else:	# some default values that seem to work for some Mesa demos	EyeSep = 0.3      # half of interocular distance	Width = 2.0       # frustum width at FocalDist	Hither = 1.0      # near clip plane distance from eye	Yon = 250.0       # far clip plane distance from eye	FocalDist = 4.0   # focal distance for stereo imaging	cr = CR()cr.MTU( 100 * 1024 * 1024 )cr.Conf( 'auto_start' , 1 )tilesortspu = SPU( "tilesort" )tilesortspu.Conf( 'bucket_mode', 'Test All Tiles' )tilesortspu.Conf( 'stereo_mode', 'Passive' )tilesortspu.Conf( 'scale_images', 1 )tilesortspu.Conf( 'split_begin_end', 1 )tilesortspu.Conf( 'sync_on_swap', 1 )tilesortspu.Conf( 'sync_on_finish', 1 )tilesortspu.Conf( 'draw_bbox', 0 )tilesortspu.Conf( 'bbox_line_width', 5 )tilesortspu.Conf( 'scale_to_mural_size', 1 )tilesortspu.Conf( 'emit_GATHER_POST_SWAPBUFFERS', 0 )tilesortspu.Conf( 'local_tile_spec', 0 )tilesortspu.Conf( 'retile_on_resize', 1 )tilesortspu.Conf( 'use_dmx', 0 )clientnode = CRApplicationNode( )clientnode.Conf( 'minimum_window_size', [0, 0] )clientnode.Conf( 'track_window_size', 0 )clientnode.Conf( 'show_cursor', 0 )clientnode.StartDir( crbindir )clientnode.SetApplication( DEMO )clientnode.AddSPU( tilesortspu )# Loop over two eye viewsfor eye in range(2):		for row in range(TILE_ROWS):			for col in range(TILE_COLS):				# layout directions				if RIGHT_TO_LEFT:					j = TILE_COLS - col - 1				else:					j = col				if BOTTOM_TO_TOP:					i = TILE_ROWS - row - 1				else:					i = row				# compute index for this tile				index = i * TILE_COLS + j				# ====================================================				renderspu = SPU( 'render' )				renderspu.Conf( 'window_geometry', [eye*(TILE_WIDTH+SideBySide_Offset), 0, TILE_WIDTH, TILE_HEIGHT] )				renderspu.Conf( 'title', "%s view" % EyeNames[eye] )				renderspu.Conf( 'try_direct', 1 )				renderspu.Conf( 'force_direct', 1 )				renderspu.Conf( 'fullscreen', 1 )				renderspu.Conf( 'on_top', 0 )				renderspu.Conf( 'render_to_app_window', 0 )				renderspu.Conf( 'render_to_crut_window', 0 )				renderspu.Conf( 'resizable', 0 )				renderspu.Conf( 'borderless', 1 )				host = SERVER_HOSTS[ index ]				servernode = CRNetworkNode( host )				# Note: same tile bounds for both views/servers!				servernode.AddTile( col * TILE_WIDTH, (TILE_ROWS - row - 1) * TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT )				servernode.Conf( 'optimize_bucket', 0 )  # just to be safe				servernode.Conf( 'stereo_view', EyeNames[eye] )				servernode.AddSPU( renderspu )				servernode.AutoStart( ["/usr/bin/rsh", host, "/bin/sh -c 'DISPLAY=%s crserver'" % (DisplayNames[eye]) ] )				# Add the server, indicating whether it's for the left or right eye.				# Actually, lefv vs. right doesn't matter if FORCE_STEREO is non-zero.				#tilesortspu.AddServer( node, protocol='tcpip', port=7000 + eye)				cr.AddNode( servernode )				tilesortspu.AddServer( servernode, protocol='tcpip', port=7000 + eye )				# ====================================================cr.AddNode( clientnode )cr.Go()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -