How to get the opengl symbolic constants using vtk?

Hi, using the vtkOpenGLState it’s possible to set specific states for a given opengl instance using for example vtkglBlendFuncSeparate.

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?

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.

1 Like

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

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