Thread: [PyOpenGL-Users] sharing opengl context with c
Brought to you by:
mcfletch
From: amand <am...@fr...> - 2014-08-20 16:58:29
|
Hello! I'am working on a project in C and I need to draw PyOpenGL stuff with embedded python. So far I have been able to draw with the embedded python. But it does not work every time... Sometimes, the Python module just raises an error (Exception OpenGL.error.GLError: GLError( err=1281, description = 'invalid value', baseOperation = glVertexAttribPointer)), and some other times, it's working perfectly... Is there a way to share the OpenGL context without any errors? -- amand. |
From: Mike C. F. <mcf...@vr...> - 2014-08-25 18:26:32
|
On 14-08-20 12:38 PM, amand wrote: > Hello! > > I'am working on a project in C and I need to draw PyOpenGL stuff with > embedded python. > > So far I have been able to draw with the embedded python. But it does > not work every time... > > Sometimes, the Python module just raises an error (Exception > OpenGL.error.GLError: GLError( err=1281, description = 'invalid value', > baseOperation = glVertexAttribPointer)), and some other times, it's > working perfectly... > > Is there a way to share the OpenGL context without any errors? Carefully. Basically you need to make sure that your C code is not interfering with the Python code. GL state is a monolithic thing, so if your C code is modifying the bound VBO, shader, etc while you are rendering then you are going to see failures where your Python is attempting to use the modified state. You need to ensure that you are always suspending C rendering before you enter Python (and suspending it in a known state), and then re-enabling C rendering when you are done. HTH, Mike -- ________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com |