I was thinking the same thing. Maybe Im grabbing it
ok, but displaying it wrong. Anyway, here is the meat
of the code. I hope the formatting on this comes out
The baseline code I used is here:
This returns a CFImageref. The only difference I made
here is changing the GL_UNSIGNED_INT_8_8_8_8_REV to
I display with the code here (I removed error checking
to make it shorter):
CGContextRef MyCreateBitmapContext (int pixelsWide,
int pixelsHigh, int*
bitmapBytesPerRow = (pixelsWide * 4);
bitmapByteCount = (bitmapBytesPerRow *
colorSpace = CGColorSpaceCreateWithName
*num_bytes = bitmapByteCount;
bitmapData = malloc( bitmapByteCount );
context = CGBitmapContextCreate (bitmapData,
CGColorSpaceRelease( colorSpace );
//display the image at 50% of original size
myImageArea = CGRectMake (0,0,width, height);
myRect = CGRectMake (0,0,width * .5, height * .5);
small_context = MyCreateBitmapContext(width * .5,
height * .5,&num_bytes);
bah = grabViaOpenGL(kCGDirectMainDisplay ,
CGContextDrawImage(small_context, myRect, mySubImage);
bah_small = CGBitmapContextCreateImage
ctx = CGDisplayGetDrawingContext
CGContextDrawImage(ctx, myRect, mySubImage);
--- Shawn Erickson <email@hidden> wrote:
> On Feb 15, 2007, at 7:54 PM, Thorrin wrote:
> > Thanks for the reply!
> > I integrated your code into what I had, but the
> > results are still the same. It looks like the
> > real differences are that you use
> > vImageVerticalReflect_ARGB8888 instead of the
> > bytes routine that I had, and your
> > value is different... I will have to step through
> > with the debugger and see what the bytes look like
> > memory to determine what is really going on there.
> > I will say that I didn't know about the vImage
> > routines before hand, so that is something to look
> > into. Also, I will look into some of the byte
> > swapping routines that Eric Wing mentioned in a
> > different email.
> You shouldn't have to do any byte swapping and if
> you do need to look
> at vImage for that (vImagePermuteChannels of course
> that function is
> 10.4 and later).
> It may help if you post a cut down but working code
> example of the
> problem you are seeing. I have a feeling it isn't
> the grab side of
> things that is the problem but how you are turning
> that buffer into
> an image.
"Everyone is allergic to giant rocks hitting them in the head!"
-Thorrin's elf chick after casting a 'meteor swarm' spell ;)
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden