Re: sharing opengl context with c

"Mike C. Fletcher" <[email protected]> Mon, 25 Aug 2014 14:26:23 -0400
Newsgroups gmane.comp.python.opengl.user
Message-ID <[email protected]>
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


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net