[Robotics] Depth information from a camera

Izaak Van Crombrugge izaak.vancrombrugge at gmail.com
Tue Jan 11 18:43:00 CET 2011


There is indeed no bgl.buffer(), but there is bgl.Buffer(). (Capital letter)
When I can't find useful documentation, I try to figure it out in the
console in Blender with autocomplete.
>>import bgl
>>bgl. (ctrl+space)
And you get the whole list.

Maybe they aren't documented because they just map all these openGL
functions?

Izaak

2011/1/11 Gilberto Echeverria <gilberto.echeverria at laas.fr>

> Hi Benoit,
>
> I'm trying to get the zbuffer using the OpenGL functions, but I'm
> running into a couple of problems.
> First, I did some experiments and I can get the zbuffer using
> bgl.glReadPixels, but specifying a section of the screen to read. How
> can I change this to use the image from VideoTexture instead? I thought
> of using the glBindBuffer method, but that doesn't seem to be
> implemented in bgl.
>
> I also have the same problem with bgl.buffer(), where I get an error
> saying that there is no attribute called 'buffer'. It seems to be caused
> by lack of support for some OpenGL functions within bgl. At least they
> don't appear in the documentation of Blender 2.49, and for Blender 2.5 I
> can't even find the bgl docs.
>
> Thanks
>
> Gilberto
>
> On 01/11/2011 12:24 PM, Benoit Bolsee wrote:
> > Hi Gilberto,
> >
> > The BGL module is still there in Blender 2.5. It is now called 'bgl' so
> > you have to "import bgl" at the start of the module. The bgl module is a
> > wrapper around OpenGL, so you can call all OpenGL functions with it. To
> > get the Zbuffer, you will need to run a custom render from a camera
> > using VideoTexture and then you can retrieve the Zbuffer using the
> > appropriate OpenGL function.
> >
> > Void pointer parameters in OpenGL map to buffer objects that you create
> > with bgl.buffer() method.
> > Unfortunately, the buffer objects returned by bgl.buffer() do not
> > support the buffer protocol, which means that you cannot export the
> > internal memory buffer to a C module. You can however access individual
> > elements of the buffer from python using sequence methods.
> > Adding support for the buffer protocol to bgl.buffer object type
> > shouldn't be difficult though.
> >
> > Hope this helps,
> > Benoit
> >
> >
> >> -----Original Message-----
> >> From: robotics-bounces at blender.org
> >> [mailto:robotics-bounces at blender.org] On Behalf Of Gilberto Echeverria
> >> Sent: mardi 11 janvier 2011 10:07
> >> To: Blender and Robotics
> >> Subject: [Robotics] Depth information from a camera
> >>
> >>
> >> Hello everyone,
> >>
> >> For the MORSE simulator, we are trying to recreate laser
> >> range scanners,
> >> that provide depth information from a sensor on a robot. We are
> >> currently doing this using ray tracing, but if we want to simulate
> >> sensor with a lot of lasers, I fear ray tracing all of them
> >> will be too
> >> slow.
> >> So my question is: Is there a way to get the depth information of a
> >> scene in a faster way? We need something that can be used
> >> from the Game
> >> Engine of Blender 2.5
> >> One possible method is to get the z-buffer from a camera. Apparently
> >> this was possible in Blender 2.49, using the BGL modules, but
> >> that seems
> >> to have disappeared from Blender 2.5.
> >>
> >> Any ideas will be greatly appreciated.
> >> Cheers
> >>
> >> Gilberto
> >> _______________________________________________
> >> Robotics mailing list
> >> Robotics at blender.org
> >> http://lists.blender.org/mailman/listinfo/robo>  tics
> >>
> >>
> >
> > _______________________________________________
> > Robotics mailing list
> > Robotics at blender.org
> > http://lists.blender.org/mailman/listinfo/robotics
> >
>
> _______________________________________________
> Robotics mailing list
> Robotics at blender.org
> http://lists.blender.org/mailman/listinfo/robotics
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/robotics/attachments/20110111/7a04c8a7/attachment.htm 


More information about the Robotics mailing list