# Why do basic classes need to be loaded in genericRenderWindow and fullScreenRenderWindow?

**URL:** https://discourse.vtk.org/t/why-do-basic-classes-need-to-be-loaded-in-genericrenderwindow-and-fullscreenrenderwindow/5810
**Category:** Web
**Created:** [May 19, 2021, 7:19am UTC](https://discourse.vtk.org/t/why-do-basic-classes-need-to-be-loaded-in-genericrenderwindow-and-fullscreenrenderwindow/5810 "2021-05-19T07:19:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![take5v](https://discourse.vtk.org/user_avatar/discourse.vtk.org/take5v/32/2810_2.png) [@take5v](https://discourse.vtk.org/u/take5v)
#### Post date: [May 19, 2021, 7:19am UTC](https://discourse.vtk.org/t/why-do-basic-classes-need-to-be-loaded-in-genericrenderwindow-and-fullscreenrenderwindow/5810/1 "2021-05-19T07:19:14Z")

</div>

Hi,

Please see [vtk-js/index.js at master · Kitware/vtk-js · GitHub](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Misc/GenericRenderWindow/index.js#L8) and [vtk-js/index.js at master · Kitware/vtk-js · GitHub](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Misc/FullScreenRenderWindow/index.js#L8). If I remove these imports I still get rendered scene and everything works fine. Why these imports must be explicitly defined? When should I define these imports?

Please also clarify, why `vtk.js/Rendering/Profiles/Volume` needs to be explicitly imported for rendering? See [vtk-js/index.js at master · Kitware/vtk-js · GitHub](https://github.com/Kitware/vtk-js/blob/master/Sources/Rendering/Core/VolumeMapper/example/index.js#L4).

Best regards,  
Stas

---

<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: [May 19, 2021, 3:05pm UTC](https://discourse.vtk.org/t/why-do-basic-classes-need-to-be-loaded-in-genericrenderwindow-and-fullscreenrenderwindow/5810/2 "2021-05-19T15:05:05Z")

</div>

Your points on the imports in the FullScreenRW and GenericRW is correct. They should not be needed. Probably added for an example a while back that was using the `vtk()` function but definitely not required here. Also if you do those import yourself somewhere else, it would have the same behavior. And won’t increase the bundle size.

For the profiles it is a different story. Those are meant to load the concrete implementation of a given mapper/actor either for WebGL or WebGPU or both so the rendering can happen. Also you don’t need to use profiles, you can just import the classes you intent to use. They will automatically register themselves into the rendering factory. But by design nothing bring them in to allow tree-shaking. That way no need to bundle +100KB of SurfaceLIC if you don’t want to use it…

---

<div class="post-metadata">

### Author: ![take5v](https://discourse.vtk.org/user_avatar/discourse.vtk.org/take5v/32/2810_2.png) [@take5v](https://discourse.vtk.org/u/take5v)
#### Post date: [May 19, 2021, 3:21pm UTC](https://discourse.vtk.org/t/why-do-basic-classes-need-to-be-loaded-in-genericrenderwindow-and-fullscreenrenderwindow/5810/3 "2021-05-19T15:21:33Z")

</div>

Thank you very much!

Regarding the profiles. I understand that if I don’t use some rendering profiles they shouldn’t be bundled. However, if I import volume/volumeMapper why not import a specific implementation? For example, when I import `@kitware/vtk.js/Rendering/Core/VolumeMapper` it ideally can load a concrete WebGL or WebGPU or both implementations. Are there any limitations for not doing so?

Best regards,  
Stas

---

<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: [May 19, 2021, 3:47pm UTC](https://discourse.vtk.org/t/why-do-basic-classes-need-to-be-loaded-in-genericrenderwindow-and-fullscreenrenderwindow/5810/4 "2021-05-19T15:47:09Z")

</div>

Yes ideally we would like to do exactly that, but because we can not conditionally import files. We would have to force it to the user. I guess WebGL could be forced today, but ideally we want to give the choice to the user. So Profiles were created to mitigate that part.

The first step was to remove the eager import all that we had before. Now that we have a clean separation that is working we could figure out a better way to make it simpler for the user. Ideally using dynamic import based on a backend(s) variable. But at the time I could not do it with the time I had available.
