¡@

Home 

2014/10/15 ¤U¤È 10:09:41

iphone Programming Glossary: glubyte

OpenGL ES 2d rendering into image

http://stackoverflow.com/questions/10455329/opengl-es-2d-rendering-into-image

your scene and use glReadPixels to grab RGBA data for the scene and place it in a byte array like in the following GLubyte rawImagePixels GLubyte malloc totalBytesForImage glReadPixels 0 0 int currentFBOSize.width int currentFBOSize.height GL_RGBA.. glReadPixels to grab RGBA data for the scene and place it in a byte array like in the following GLubyte rawImagePixels GLubyte malloc totalBytesForImage glReadPixels 0 0 int currentFBOSize.width int currentFBOSize.height GL_RGBA GL_UNSIGNED_BYTE rawImagePixels.. format not the RGBA of glReadPixels using something like CVPixelBufferLockBaseAddress renderTarget 0 _rawBytesForImage GLubyte CVPixelBufferGetBaseAddress renderTarget Do something with the bytes CVPixelBufferUnlockBaseAddress renderTarget 0 However..

Drawing into OpenGL ES framebuffer and getting UIImage from it on iPhone

http://stackoverflow.com/questions/10936157/drawing-into-opengl-es-framebuffer-and-getting-uiimage-from-it-on-iphone

from _frameBuffer and return it as UIImage this part is working NSInteger x 0 y 0 NSInteger dataLength width height 4 GLubyte data GLubyte malloc dataLength sizeof GLubyte glPixelStorei GL_PACK_ALIGNMENT 4 glReadPixels x y width height GL_RGBA GL_UNSIGNED_BYTE.. and return it as UIImage this part is working NSInteger x 0 y 0 NSInteger dataLength width height 4 GLubyte data GLubyte malloc dataLength sizeof GLubyte glPixelStorei GL_PACK_ALIGNMENT 4 glReadPixels x y width height GL_RGBA GL_UNSIGNED_BYTE.. part is working NSInteger x 0 y 0 NSInteger dataLength width height 4 GLubyte data GLubyte malloc dataLength sizeof GLubyte glPixelStorei GL_PACK_ALIGNMENT 4 glReadPixels x y width height GL_RGBA GL_UNSIGNED_BYTE data CGDataProviderRef ref CGDataProviderCreateWithData..

iOS CVImageBuffer distorted from AVCaptureSessionDataOutput with AVCaptureSessionPresetPhoto

http://stackoverflow.com/questions/6540710/ios-cvimagebuffer-distorted-from-avcapturesessiondataoutput-with-avcapturesessio

size_t bytesPerRow extraBytes bytesPerRow CVPixelBufferGetBytesPerRow pixelBuffer extraBytes bytesPerRow frameWidth 4 GLubyte pixelBufferAddr CVPixelBufferGetBaseAddress pixelBuffer if captureSession sessionPreset isEqualToString @ AVCaptureSessionPresetPhoto.. GL_TEXTURE_2D 0 GL_RGBA frameWidth frameHeight 0 GL_BGRA GL_UNSIGNED_BYTE NULL for int h 0 h frameHeight h GLubyte row pixelBufferAddr h frameWidth 4 extraBytes glTexSubImage2D GL_TEXTURE_2D 0 0 h frameWidth 1 GL_BGRA GL_UNSIGNED_BYTE..

iPhone take augmented reality screenshot with AVCaptureVideoPreviewLayer

http://stackoverflow.com/questions/8980847/iphone-take-augmented-reality-screenshot-with-avcapturevideopreviewlayer

height 4 NSUInteger i for i 0 i 100 i glFlush CFRunLoopRunInMode kCFRunLoopDefaultMode float 1.0 float 60.0 FALSE GLubyte data GLubyte malloc dataLength sizeof GLubyte Read pixel data from the framebuffer glPixelStorei GL_PACK_ALIGNMENT 4 glReadPixels.. NSUInteger i for i 0 i 100 i glFlush CFRunLoopRunInMode kCFRunLoopDefaultMode float 1.0 float 60.0 FALSE GLubyte data GLubyte malloc dataLength sizeof GLubyte Read pixel data from the framebuffer glPixelStorei GL_PACK_ALIGNMENT 4 glReadPixels x y.. CFRunLoopRunInMode kCFRunLoopDefaultMode float 1.0 float 60.0 FALSE GLubyte data GLubyte malloc dataLength sizeof GLubyte Read pixel data from the framebuffer glPixelStorei GL_PACK_ALIGNMENT 4 glReadPixels x y width height GL_RGBA GL_UNSIGNED_BYTE..

Record the drawing as a m4v video file - OpenGL

http://stackoverflow.com/questions/9661259/record-the-drawing-as-a-m4v-video-file-opengl

it's unarchived it's sent initWithCoder id initWithCoder NSCoder coder CGImageRef brushImage CGContextRef brushContext GLubyte brushData size_t width height if self super initWithCoder coder CAEAGLLayer eaglLayer CAEAGLLayer self.layer eaglLayer.opaque.. not a power of 2. Make sure the image exists if brushImage Allocate memory needed for the bitmap context brushData GLubyte calloc width height 4 sizeof GLubyte Use the bitmatp creation function provided by the Core Graphics framework. brushContext.. exists if brushImage Allocate memory needed for the bitmap context brushData GLubyte calloc width height 4 sizeof GLubyte Use the bitmatp creation function provided by the Core Graphics framework. brushContext CGBitmapContextCreate brushData..

Saving imageRef from GLPaint creates completely black image

http://stackoverflow.com/questions/9857912/saving-imageref-from-glpaint-creates-completely-black-image

const int h self.frame.size.height const NSInteger myDataLength w h 4 s s allocate array and read pixels into it. GLubyte buffer GLubyte malloc myDataLength glReadPixels 0 0 w s h s GL_RGBA GL_UNSIGNED_BYTE buffer gl renders upside down so swap.. h self.frame.size.height const NSInteger myDataLength w h 4 s s allocate array and read pixels into it. GLubyte buffer GLubyte malloc myDataLength glReadPixels 0 0 w s h s GL_RGBA GL_UNSIGNED_BYTE buffer gl renders upside down so swap top to bottom.. buffer gl renders upside down so swap top to bottom into new array. there's gotta be a better way but this works. GLubyte buffer2 GLubyte malloc myDataLength for int y 0 y h s y memcpy buffer2 h s 1 y w 4 s buffer y 4 w s w 4 s free buffer work..