# How to get the opengl symbolic constants using vtk?

**URL:** https://discourse.vtk.org/t/how-to-get-the-opengl-symbolic-constants-using-vtk/6028
**Category:** Support
**Created:** [June 21, 2021, 3:54pm UTC](https://discourse.vtk.org/t/how-to-get-the-opengl-symbolic-constants-using-vtk/6028 "2021-06-21T15:54:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![devmessias](https://discourse.vtk.org/user_avatar/discourse.vtk.org/devmessias/32/3364_2.png) [@devmessias](https://discourse.vtk.org/u/devmessias)
#### Post date: [June 21, 2021, 3:54pm UTC](https://discourse.vtk.org/t/how-to-get-the-opengl-symbolic-constants-using-vtk/6028/1 "2021-06-21T15:54:29Z")

</div>

Hi, using the vtkOpenGLState it’s possible to set specific states for a given opengl instance using for example [vtkglBlendFuncSeparate](https://vtk.org/doc/nightly/html/classvtkOpenGLState.html#a5999720b720fb8c63fe18173623e4bcf).

My question it’s how I get the unsigned values from symbolic constants like  
GL\_ZERO , GL\_ONE , GL\_SRC\_COLOR , GL\_ONE\_MINUS\_SRC\_COLOR using vtk-python?

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [June 22, 2021, 1:11pm UTC](https://discourse.vtk.org/t/how-to-get-the-opengl-symbolic-constants-using-vtk/6028/2 "2021-06-22T13:11:58Z")

</div>

You can “pip install pyopengl” to get those constants (they will be in the OpenGL.GL module). I’ve never tried shader programming through Python, so I’m interested to see what results you get.

---

<div class="post-metadata">

### Author: ![devmessias](https://discourse.vtk.org/user_avatar/discourse.vtk.org/devmessias/32/3364_2.png) [@devmessias](https://discourse.vtk.org/u/devmessias)
#### Post date: [June 22, 2021, 1:21pm UTC](https://discourse.vtk.org/t/how-to-get-the-opengl-symbolic-constants-using-vtk/6028/3 "2021-06-22T13:21:43Z")

</div>

> [@dgobbi](#):
>
> OpenGL.GL

Thanks @dgobbi. But I want to avoid inject new dependency in the project.  
I just want to control my opengl state in vtk. For example, depth\_test it’s always enabled in vtk. I need to disable that. Currently, I’ve just created a python dictionary with the most important gl\_numbers

```python
GL_NUMBERS = {
    "GL_SRC_ALPHA": 770,
    "GL_ONE": 1,
    "GL_ZERO": 0,
    "GL_BLEND": 3042,
    "GL_ONE_MINUS_SRC_ALPHA": 771,
    "GL_SRC_ALPHA": 770,
    "GL_DEPTH_TEST": 2929,
    "GL_DST_COLOR": 774,
    "GL_FUNC_SUBTRACT": 3277,
    "GL_CULL_FACE": 2884,
    "GL_ALPHA_TEST": 3008,
    "GL_CW": 2304,
    "GL_CCW": 2305,
    "GL_ONE_MINUS_SRC_COLOR": 769,
    "GL_SRC_COLOR": 768
}

```

This is my result with different opengl-states

 ![image](https://discourse.vtk.org/uploads/default/original/2X/4/44095abce67ad8ea4aa05576b88478458c5e64b1.png)
