liyunfei18
(Liyunfei18)
January 18, 2021, 3:35pm
1
I want to use vtkFPSMonitor to display fps and I use setRenderWindow to pass my renderWindow to vtkFPSMonitor. The canvas in vtkFPSMonitor works well, but the info cannot be displayed.
This is function renderInfo():
function renderInfo() {
model.info.style.display = model.infoVisibility ? 'grid' : 'none';
if (!model.infoVisibility) {
return;
}
const infoItems = [];
if (model.renderWindow) {
const realView = model.renderWindow.getViews()[0];
if (realView && realView.getSize) {
infoItems.push(
`<label class="${style.label}">Resolution</label><span class="${
style.value
}">${realView.getSize().join('x')}</span>`
);
}
I found that the model.renderWindow is always undefined, so I cannot get info. I hope someone can tell me what went wrong, thanks!
Can you share your code? Did you look at the example that was using it?
liyunfei18
(Liyunfei18)
January 19, 2021, 2:45am
3
thank you for your replyļ¼This is my codeļ¼
this.fullScreenRenderer = vtkFullScreenRenderWindow.newInstance({
rootContainer: geoViewer,
});
this.renderWindow = this.fullScreenRenderer.getRenderWindow();
let FPSContainer = document.getElementById(āfpsā);
this.FPSWidget = vtkFPSMonitor.newInstance();
this.FPSWidget.setContainer(FPSContainer);
this.FPSWidget.setRenderWindow(this.renderWindow);
this.FPSWidget.setOrientation(āverticalā);
By the way, I am sorry I didnāt find an example of vtkFPSMonitor in https://kitware.github.io/vtk-js/examples/index.html .
Here is an example using it
Does document.getElementById(āfpsā);
properly resolve to a DOM element?
liyunfei18
(Liyunfei18)
January 20, 2021, 9:08am
5
Thanks again! I think I know where the problem is. It looks like the this.FPSWidget.update() function function is not called. When I added this.FPSWidget.update() after the original code, it seemed to workā¦
1 Like