[squeak-dev] Re: Still pounding head against wall over glReadPixels => external buffer

Andreas Raab andreas.raab at gmx.de
Thu Feb 11 17:25:26 UTC 2010


Lawson English wrote:
> ogl                     "read pixels into my buffer"
>    glReadPixels: 0
>    with:  -100
>    with: 100
>    with: 100
>    with: ogl imagePixelFormat32
>    with: ogl imagePixelType32
>    with: xData.

Reading from -100? That would be offscreen. Try replacing the -100 with 
0 and you'll get a lot further.

Cheers,
   - Andreas

> 
> xHandle byteAt: 1000=> 0   "print byte value in my buffer???"
> xHandle byteAt: 1000 put: 10   "manually set byte value in my buffer"
> xHandle byteAt: 1000  =>  10  "print byte value in my buffer???????"
> 
> 
> 
> 
> 
> 
> Andreas Raab wrote:
>> Lawson English wrote:
>>> I'm still having problems with my external shared memory thingie. I 
>>> can evoke the unix shm* calls and obtain a reference to a shared 
>>> memory buffer and attach it to squeak's heap. I can write into it and 
>>> read back. I can even attach the same shared memory to two different 
>>> instances of squeak and write to the buffer in one and read it with 
>>> the other. What I still cannot figure out is how to take that 
>>> external buffer and direct the OpenGL>>glReadPixels call to it so 
>>> that I can draw using squeak and have it become a bitmap for a 
>>> different application.
>>
>> Post your code. Using glReadPixels is straightforward, so there must 
>> be something simple in your code that goes wrong. Simply speaking the 
>> following should work fine:
>>
>> "Allocate or obtain shared memory buffer"
>> xHandle := ExternalHandle allocate: rect width * rect height * 4.
>>
>> "Convert it to ExternalData"
>> xData := ExternalData fromHandle: xHandle type: ExternalType void 
>> asPointerType.
>>
>> "Call glReadPixels"
>> ogl
>>     glReadPixels: rect left
>>     with: ogl extent y - rect bottom
>>     with: rect width
>>     with: rect height
>>     with: ogl imagePixelFormat32
>>     with: ogl imagePixelType32
>>     with: xData.
>>
>> This should be all there is to it.
>>
>> Cheers,
>>   - Andreas
>>
>>
> 
> 
> 




More information about the Squeak-dev mailing list