# vtkFPSMonitor

**URL:** https://discourse.vtk.org/t/vtkfpsmonitor/5031
**Category:** Web
**Created:** [January 18, 2021, 3:35pm UTC](https://discourse.vtk.org/t/vtkfpsmonitor/5031 "2021-01-18T15:35:12Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![liyunfei18](https://discourse.vtk.org/user_avatar/discourse.vtk.org/liyunfei18/32/2691_2.png) [@liyunfei18](https://discourse.vtk.org/u/liyunfei18)
#### Post date: [January 18, 2021, 3:35pm UTC](https://discourse.vtk.org/t/vtkfpsmonitor/5031/1 "2021-01-18T15:35:12Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [January 18, 2021, 4:17pm UTC](https://discourse.vtk.org/t/vtkfpsmonitor/5031/2 "2021-01-18T16:17:40Z")

</div>

Can you share your code? Did you look at the example that was using it?

---

<div class="post-metadata">

### Author: ![liyunfei18](https://discourse.vtk.org/user_avatar/discourse.vtk.org/liyunfei18/32/2691_2.png) [@liyunfei18](https://discourse.vtk.org/u/liyunfei18)
#### Post date: [January 19, 2021, 2:45am UTC](https://discourse.vtk.org/t/vtkfpsmonitor/5031/3 "2021-01-19T02:45:32Z")

</div>

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](https://kitware.github.io/vtk-js/examples/index.html).

---

<div class="post-metadata">

### Author: ![Sebastien\_Jourdain](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sebastien_jourdain/32/100_2.png) [@Sebastien\_Jourdain](https://discourse.vtk.org/u/Sebastien_Jourdain)
#### Post date: [January 19, 2021, 4:02pm UTC](https://discourse.vtk.org/t/vtkfpsmonitor/5031/4 "2021-01-19T16:02:00Z")

</div>

Here is an example using it

> **[vtk.js](https://kitware.github.io/vtk-js/examples/Cone.html)**
>
> ConeLive example Sourceimport 'vtk.js/Sources/favicon';import vtkActor from 'vtk.js/Sources/Rendering/Core/Actor';import vtkCalculator from 'vtk.js/Sources/Filters/General/Calculator';import vtkConeS

Does ` document.getElementById(“fps”);` properly resolve to a DOM element?

---

<div class="post-metadata">

### Author: ![liyunfei18](https://discourse.vtk.org/user_avatar/discourse.vtk.org/liyunfei18/32/2691_2.png) [@liyunfei18](https://discourse.vtk.org/u/liyunfei18)
#### Post date: [January 20, 2021, 9:08am UTC](https://discourse.vtk.org/t/vtkfpsmonitor/5031/5 "2021-01-20T09:08:29Z")

</div>

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…
