# OpenGL Stencil

**URL:** https://discourse.vtk.org/t/opengl-stencil/14272
**Category:** Support
**Created:** [July 22, 2024, 9:19am UTC](https://discourse.vtk.org/t/opengl-stencil/14272 "2024-07-22T09:19:38Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [July 22, 2024, 2:09pm UTC](https://discourse.vtk.org/t/opengl-stencil/14272/2 "2024-07-22T14:09:28Z")

</div>

Hello,

I don’t know how you got the `state` object, but I’d advise to take a look at this: [How to use original OpenGL in VTK program? - Support - VTK](https://discourse.vtk.org/t/how-to-use-original-opengl-in-vtk-program/4636).

So you basically need to create a standalone OpenGL window and then pass its OpenGL context to VTK to use for rendering. The code example is in C++, then you’ll need to translate it to whatever you’re using.

best,

PC

---

_[View the full topic](https://discourse.vtk.org/t/opengl-stencil/14272)._
