Re: Attribute error using PyOpenGL and PyOpenCL

Joe <[email protected]> Mon, 06 Oct 2014 12:24:39 +0200
Newsgroups gmane.comp.python.opengl.user
Message-ID <[email protected]>
Hello,

thanks for your reply.
The example is working now, I replaced the buffers entry
with int(<vbo>) as you suggested.

But after that I ran into another problem, which I found
a solution for but I don't know why it works.

Here again the link to the example:
https://gitorious.org/openclgltest/openclgltest/source/7b9969ef093e7bc04100a860588e6bb115731d97:testpyopengl.py#L173

There was a "wrong type" error in the last parameter of the
following calls:

 > 173 gl.glVertexPointer(4, gl.GL_FLOAT, 0, self.arrvbo)
 > 175 gl.glColorPointer(4, gl.GL_FLOAT, 0, self.colvbo)

I did not know what to do and changed it to "None":

 > 173 gl.glVertexPointer(4, gl.GL_FLOAT, 0, None)
 > 175 gl.glColorPointer(4, gl.GL_FLOAT, 0, None)

and that worked. But I have absolutly no idea why.
Why do the functions know where the vertices / colors
are as I do not specify a pointer to the VBO?

Has it something to do with the .bind() calls of the VBO
before glVertexPointer / glColorPointer?

 > self.arrvbo.bind()
 > gl.glVertexPointer(4, gl.GL_FLOAT, 0, self.arrvbo)

 > self.colvbo.bind()
 > gl.glColorPointer(4, gl.GL_FLOAT, 0, self.colvbo)

Kind regards,
Joe

Am 30.09.2014 21:24, schrieb Mike C. Fletcher:
> On 14-09-24 07:40 AM, Walter White wrote:
>> Hello,
>>
>> I came across a problem and hope that you can help me,
>> since I could not find a solution crawling the net.
>
> Basically the code is trying to access the "buffers" member of the VBO
> object. The OpenGL_accelerate version of the VBO (the cython-implemented
> one) does *not* have a .buffers (list), only a .buffer (int). Probably
> the attributes should be named _buffer and/or _buffers, as they aren't
> normally used by external code, the normal way to get the ID of the VBO
> is int(<vbo>).
>
> HTH,
> Mike
>


------------------------------------------------------------------------------
Slashdot TV.  Videos for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net