Oct 24, 2012

Moving

The blog is moved to my personal website.

please see the section "Technical adventure"

http://tanin.nanakorn.com

Mar 19, 2012

OpenGL ES (Shader) facts #1

- There is no type-casting. Use constructor.
- When declaring float or vec, you must declare its precision, otherwise there would be a compile-time error.
- You cannot multiply float with integer because there is no type-casting.
- There is no left-shift and right-shift.

Stupid path NSBundle pathForResource:

Don't forget to add the file to "Copy Bundle Resources"...

Manual Camera on iPhone

Today I have succeeded at streaming video from camera and showing it on the screen. Also, I have succeeded at manipulating pixels before showing it.

The normal way is to:

1. Write your own AVCaptureVideoDataOutputSampleBufferDelegate.
2. Get CVImageBuffer, which is from CVPixelBuffer
3. Manipulate pixels at their addresses
4. Create CVImageRef from CVImageBuffer
4. setContents of the CALayer with your CVImageRef

This is a normal way. You may also channel CVImageBufferRef to OpenGL in order to manipulate pixels with OpenGL Shader.

The vital technique is not to copy anything but to manipulate the pixels at their addresses directly.

It seems to me that using OpenGL shader is a better idea because:

1. It is run on GPU. This means it does not consume CPU time.
2. It is optimized for parallel stuffs.

I'm too lazy to post the code here.

Mar 12, 2012

Deploying to iOS 4.2.1 problem

warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).
 
If you found this problem, it is because the OS is copied from your iPod/iPhone, and it does not have the necessary library.
 
In order to solve it, you must copy

/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/Developer 
/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr
 
And paste these folders under /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/
.
 
That's it.

DISPATCH_QUEUE_PRIORITY_BACKGROUND in dispatch_async causes EXC_BAD_ACCESS in iOS 4.2.1 and earlier

This is because DISPATCH_QUEUE_PRIORITY_BACKGROUND does not exist.

Please use DISPATCH_QUEUE_PRIORITY_LOW.

!NO is not YES..

Today I have found out that

if (!NO) { ... }

is not working as I expect...

!NO is not a true statement.