Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using glReadPixels



Peter Teeson wrote:
>
> >here's the code:
> >GLbyte *thePixels;
> >glReadBuffer(GL_FRONT_LEFT); // Is this necessary since I read from
> >the default
> >buffer?
> >glReadPixels(10,10, 10,10, GL_RGBA, GL_BYTE, &thePixels);
> >cout << (int)thePixels[0] << endl;
>
> Firstly thePixels is just a pointer to some memory. But have you
> allocated and intialised it?
> Secondly why are you passing &thePixels? Shouldn't it be just thePixels?
> The Blue book documents the function signature as:

Yes you are right, I've arranged my code to look like this and it works.
GLbyte *thePixels = new GLbyte[width*height*4];
glReadBuffer(GL_FRONT_LEFT);
glReadPixels(0,0, width,height, GL_RGBA, GL_BYTE, thePixels);

Unfortunately, the images I get are darker than the real thing... I tried
multiplying the pixels * 2 and I got brighter colors but some dark area (ie.
background (0.2, 0.2, 0.2)) is still darker than the real thing!... I guess
this has something to do with gamma... What other functions I should look to
arrange this problem? To know the gamma of my renderings and to be able to write
the same gamma to my files?...

Thanks,
Simon

--
+-------------------------+----------------------------------+
| Simon Lemieux | Website : http://www.666Mhz.net |
| Email : email@hidden | POV-Ray, OpenGL, C++ and more... |
+-------------------------+----------------------------------+


References: 
 >Re: Using glReadPixels (From: Peter Teeson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.