How to use the secondary monitor?

In my setup I have two monitors, with second being 120Hz and first being 60Hz. I want to create a Panda window on the second monitor and lock the refresh rate to 120Hz. While I see in the manual how to enable vsync and lock the frame rate, I couldn’t find info how to specify what display to open the Panda window on.

Hi, welcome to the forums!

Perhaps just using the window origin to place it past the end of the first monitor on the virtual desktop will work?

Which operating system are you using?

Hi rdb,

Sorry, I’m running on 64bit Windows 10.

My concern with creating the window on the first monitor and then moving it is that the max refresh rate may be locked to vsync of the first monitor rather than the second one.

Note that the resolutions of the two monitors also do not match, so we don’t end up with an extended display with total of X*2 x Y resolution.

How should I test this?

Update: The framerate meter that comes with Panda seems to indicate that the vsync framerate of the Panda window is updated as the window is moved to a new display. However there seems to be issue with the Panda3D Task timing when I do this.

Here’s what I do and my code to show the problem:
I’m running tests on human perception of pixel shifting at 120Hz (there are different rows displayed each frame, persistence of vision is meant to combine them into one frame).
My code seems to run fine on the 60Hz primary monitor, flickery because the pixel shifting is done at 60Hz, but when I move the window to the second monitor, the pixel shifting stops. It doesn’t stop in the sense that it is not perceivable, but in the sense that only one of the pixel row image is visible, meaning that either the task has been frozen, which a simple debug line show isn’t the case, or that the timing has messed up, which seems to be the case given that a highspeed camera shows that indeed only one row of pixels is shown all the time.

from panda3d.core import *
from direct.showbase.ShowBase import ShowBase
from direct.task import Task

load_prc_file_data("", "vsync true")
load_prc_file_data("", "win-size 1280 720")
load_prc_file_data("", "textures-auto-power-2 1")
load_prc_file_data("", "textures-power-2 up ")

base = ShowBase()

def load_image_as_plane(filepath, yresolution = 720):
	tex = loader.load_texture(filepath)
	# disable texture filtering, optional
	cm = CardMaker(filepath + " card")
	cm.set_frame(-tex.get_orig_file_x_size(), tex.get_orig_file_x_size(), -tex.get_orig_file_y_size(), tex.get_orig_file_y_size())
	card = NodePath(cm.generate())
	card.set_scale(card.get_scale()/ yresolution)
	card.flatten_light() # apply scale
	return card

image1 = load_image_as_plane("1.png")
image2 = load_image_as_plane("2.png")

def pixel_shift(task):
	if image1.is_hidden() == True:; image2.hide()
	else:; image1.hide()

	return task.cont

base.task_mgr.add(pixel_shift, "pixel_shift")

Hmm… This is a bit of a guess, but what happens if you set an explicit clock-rate of 120Hz, either together with or instead of enabling v-sync?

Something like this:

load_prc_file_data("", "clock-mode limited")
load_prc_file_data("", "clock-frame-rate 120")

In both these cases the two images displaying the different rows seem to be shifted randomly and slower.

Please note that the config.prc setting for vsync is sync-video, not vsync.

Thanks, looks like Panda was using the setting from Config.prc instead.
However, this doesn’t fix the issue.
Turning off the main monitor and running the script then seems to run correctly. I think we have a more general bug or issue here relating to multimonitor setups and the task manager.