Re: PyOpenGL_accelerate / subclassed numpy arrays
Chris Barker <[email protected]> Sun, 8 Nov 2015 09:04:54 -0800
| Newsgroups | gmane.comp.python.opengl.user |
|---|---|
| Message-ID | <CALGmxE+BCVG9z135-Bf=dUvmph4nqXmFmRkFTfwE=un1_nVEMg@mail.gmail.com> |
--===============5095343381128339971== Content-Type: multipart/alternative; boundary=001a113d58a61c73c905240a7c8a --001a113d58a61c73c905240a7c8a Content-Type: text/plain; charset=UTF-8 On Sun, Nov 8, 2015 at 8:20 AM, Rob McMullen - NOAA Affiliate < [email protected]> wrote: > I know I've run into that problem when my VBO data was in recarray format. > Defining the VBO as a view of the array in dtype=np.float32 format worked. > I haven't lloked an ANY of the relevant coce here, but this seems to indicae that PyOpenGL_accelerate can't handle subclasses of ndarray -- which doesn't surprise me -- it's notoriously difficult to do that. but the error: File "arraydatatype.pyx", line 57, in OpenGL_accelerate. arraydatatype.HandlerRegistry.c_lookup (src/arraydatatype.c:2230) TypeError: No array-type handler for type <class 'glumpy.gloo.buffer.VertexBuffer'> (value: VertexBuffer([151, 10, 1, ..., 0, 128, 63], ) registered makes me think that arraydatatype.HandlerRegistry is where you need to put awareness of a new subclass. or it needs to be fixed to recognize ndarray subclasses -- either by directly checking if it is a proper subclass, or by using the array protocol -- which I think is the __array__ method... HTH, -CHris > Rob > > On Thu, Nov 5, 2015 at 11:08 PM, Nicolas P. Rougier < > [email protected]> wrote: > >> >> I've made a numpy array subclass for a vertex buffer that works great >> with PyOpenGL but does not work if PyOpenGL_accelerate is installed, it >> complains about about missing handler: >> >> File "/Users/rougier/Development/Public/glumpy/glumpy/gloo/buffer.py", >> line 75, in _update >> gl.glBufferSubData(self.target, offset, nbytes, data) >> File "latebind.pyx", line 44, in >> OpenGL_accelerate.latebind.Curry.__call__ (src/latebind.c:1201) >> File >> "/usr/locaL/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/OpenGL/GL/VERSION/GL_1_5.py", >> line 122, in glBufferSubData >> data = ArrayDatatype.asArray( data ) >> File "arraydatatype.pyx", line 174, in >> OpenGL_accelerate.arraydatatype.ArrayDatatype.asArray >> (src/arraydatatype.c:4221) >> File "arraydatatype.pyx", line 57, in >> OpenGL_accelerate.arraydatatype.HandlerRegistry.c_lookup >> (src/arraydatatype.c:2230) >> TypeError: No array-type handler for type <class >> 'glumpy.gloo.buffer.VertexBuffer'> (value: VertexBuffer([151, 10, 1, >> ..., 0, 128, 63], ) registered >> >> >> Python: 3.5 >> PyOpenGL: 3.1.0 >> PyOpenGL_accelerate: 3.1.0 >> The package I'm developing: http://glumpy.github.io >> >> Any idea ? >> >> Nicolas >> >> >> >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> PyOpenGL Homepage >> http://pyopengl.sourceforge.net >> _______________________________________________ >> PyOpenGL-Users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/pyopengl-users >> > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > PyOpenGL Homepage > http://pyopengl.sourceforge.net > _______________________________________________ > PyOpenGL-Users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pyopengl-users > > -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [email protected] --001a113d58a61c73c905240a7c8a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On S= un, Nov 8, 2015 at 8:20 AM, Rob McMullen - NOAA Affiliate <span dir=3D"ltr"= ><<a href=3D"mailto:[email protected]" target=3D"_blank">rob.mcmulle= [email protected]</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style= =3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(20= 4,204,204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr">I kno= w I've run into that problem when my VBO data was in recarray format. D= efining the VBO as a view of the array in dtype=3Dnp.float32 format worked.= </div></blockquote><div><br></div><div>I haven't lloked an ANY of the r= elevant coce here, but this seems to indicae that =C2=A0<span style=3D"colo= r:rgb(80,0,80)">PyOpenGL_accelerate can't handle subclasses of ndarray = -- which doesn't surprise me -- it's notoriously difficult to do th= at.</span></div><div><span style=3D"color:rgb(80,0,80)"><br></span></div><d= iv><span style=3D"color:rgb(80,0,80)">but the error:</span></div><div><span= style=3D"color:rgb(80,0,80)"><br></span></div><div><span style=3D"font-siz= e:12.8px">=C2=A0File "arraydatatype.pyx", line 57, in OpenGL_acce= lerate.</span><span style=3D"font-size:12.8px">arraydatatype.HandlerRegistr= y.</span><span style=3D"font-size:12.8px">c_lookup (src/arraydatatype.c:223= 0)</span><br style=3D"font-size:12.8px"><span style=3D"font-size:12.8px">Ty= peError: No array-type handler for type <class 'glumpy.gloo.buffer.<= /span><span style=3D"font-size:12.8px">VertexBuffer'> (value: Vertex= Buffer([151,=C2=A0 10,=C2=A0 =C2=A01, ...,=C2=A0 =C2=A00, 128,=C2=A0 63], )= registered</span><br></div><div><br></div><div>makes me think that=C2=A0<s= pan style=3D"font-size:12.8px">arraydatatype.HandlerRegistry is where you n= eed to put awareness of a new subclass.</span></div><div><span style=3D"fon= t-size:12.8px"><br></span></div><div><span style=3D"font-size:12.8px">or it= needs to be fixed to=C2=A0recognize=C2=A0ndarray subclasses -- either by d= irectly checking if it is a proper subclass, or by using the array protocol= -- which I think is the __array__ method...</span></div><div><span style= =3D"font-size:12.8px"><br></span></div><div><span style=3D"font-size:12.8px= ">HTH,</span></div><div><span style=3D"font-size:12.8px"><br></span></div><= div><span style=3D"font-size:12.8px">-CHris</span></div><div><span style=3D= "font-size:12.8px"><br></span></div><div><br></div><div>=C2=A0</div><blockq= uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-wi= dth:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-= left:1ex"><div dir=3D"ltr"><span class=3D""><font color=3D"#888888"><div>Ro= b</div></font></span></div><div class=3D""><div class=3D"h5"><div class=3D"= gmail_extra"><br><div class=3D"gmail_quote">On Thu, Nov 5, 2015 at 11:08 PM= , Nicolas P. Rougier <span dir=3D"ltr"><<a href=3D"mailto:Nicolas.Rougie= [email protected]" target=3D"_blank">[email protected]</a>></span> wrote= :<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo= rder-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:so= lid;padding-left:1ex"><br> I've made a numpy array subclass for a vertex buffer that works great w= ith PyOpenGL but does not work if PyOpenGL_accelerate is installed, it comp= lains about about missing handler:<br> <br> File "/Users/rougier/Development/Public/glumpy/glumpy/gloo/buffer.py&q= uot;, line 75, in _update<br> =C2=A0 =C2=A0 gl.glBufferSubData(self.target, offset, nbytes, data)<br> =C2=A0 File "latebind.pyx", line 44, in OpenGL_accelerate.latebin= d.Curry.__call__ (src/latebind.c:1201)<br> =C2=A0 File "/usr/locaL/Cellar/python3/3.5.0/Frameworks/Python.framewo= rk/Versions/3.5/lib/python3.5/site-packages/OpenGL/GL/VERSION/GL_1_5.py&quo= t;, line 122, in glBufferSubData<br> =C2=A0 =C2=A0 data =3D ArrayDatatype.asArray( data )<br> =C2=A0 File "arraydatatype.pyx", line 174, in OpenGL_accelerate.a= rraydatatype.ArrayDatatype.asArray (src/arraydatatype.c:4221)<br> =C2=A0 File "arraydatatype.pyx", line 57, in OpenGL_accelerate.ar= raydatatype.HandlerRegistry.c_lookup (src/arraydatatype.c:2230)<br> TypeError: No array-type handler for type <class 'glumpy.gloo.buffer= .VertexBuffer'> (value: VertexBuffer([151,=C2=A0 10,=C2=A0 =C2=A01, = ...,=C2=A0 =C2=A00, 128,=C2=A0 63], ) registered<br> <br> <br> Python: 3.5<br> PyOpenGL: 3.1.0<br> PyOpenGL_accelerate: 3.1.0<br> The package I'm developing: <a href=3D"http://glumpy.github.io" rel=3D"= noreferrer" target=3D"_blank">http://glumpy.github.io</a><br> <br> Any idea ?<br> <br> Nicolas<br> <br> <br> <br> ---------------------------------------------------------------------------= ---<br> _______________________________________________<br> PyOpenGL Homepage<br> <a href=3D"http://pyopengl.sourceforge.net" rel=3D"noreferrer" target=3D"_b= lank">http://pyopengl.sourceforge.net</a><br> _______________________________________________<br> PyOpenGL-Users mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">P= [email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/pyopengl-users" rel= =3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi= nfo/pyopengl-users</a><br> </blockquote></div><br></div> </div></div><br>-----------------------------------------------------------= -------------------<br> <br>_______________________________________________<br> PyOpenGL Homepage<br> <a href=3D"http://pyopengl.sourceforge.net" rel=3D"noreferrer" target=3D"_b= lank">http://pyopengl.sourceforge.net</a><br> _______________________________________________<br> PyOpenGL-Users mailing list<br> <a href=3D"mailto:[email protected]">PyOpenGL-Users@list= s.sourceforge.net</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/pyopengl-users" rel= =3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi= nfo/pyopengl-users</a><br> <br></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div cla= ss=3D"gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><b= r>Emergency Response Division<br>NOAA/NOS/OR&R =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(206) 526-6959=C2=A0=C2=A0 voice<br>7600 Sand Point Way NE= =C2=A0=C2=A0(206) 526-6329=C2=A0=C2=A0 fax<br>Seattle, WA =C2=A098115 =C2= =A0 =C2=A0 =C2=A0=C2=A0(206) 526-6317=C2=A0=C2=A0 main reception<br><br><a = href=3D"mailto:[email protected]" target=3D"_blank">[email protected]= ov</a></div> </div></div> --001a113d58a61c73c905240a7c8a-- --===============5095343381128339971== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ --===============5095343381128339971== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ PyOpenGL Homepage http://pyopengl.sourceforge.net _______________________________________________ PyOpenGL-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyopengl-users --===============5095343381128339971==--