Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I rewrite the GLCameraRipple sample without using iOS 5.0-specific features?
    primarykey
    data
    text
    <p>How can I rewrite Apple's <a href="http://developer.apple.com/library/ios/samplecode/GLCameraRipple/" rel="nofollow">GLCameraRipple example</a> so that it doesn't require iOS 5.0?</p> <p>I need to have it run on iOS 4.x, so I cannot use CVOpenGLESTextureCacheCreateTextureFromImage. What should I do?</p> <p>As a follow on, I'm using the code below to provide YUV data rather than RGB, but the picture is not right, the screen is green. It seems as though UV plane doesn't work.</p> <pre><code>CVPixelBufferLockBaseAddress(cameraFrame, 0); int bufferHeight = CVPixelBufferGetHeight(cameraFrame); int bufferWidth = CVPixelBufferGetWidth(cameraFrame); // Create a new texture from the camera frame data, display that using the shaders glActiveTexture(GL_TEXTURE0); glGenTextures(1, &amp;_lumaTexture); glBindTexture(GL_TEXTURE_2D, _lumaTexture); glUniform1i(UNIFORM[Y], 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // This is necessary for non-power-of-two textures glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, bufferWidth, bufferHeight, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, CVPixelBufferGetBaseAddressOfPlane(cameraFrame, 0)); glActiveTexture(GL_TEXTURE1); glGenTextures(1, &amp;_chromaTexture); glBindTexture(GL_TEXTURE_2D, _chromaTexture); glUniform1i(UNIFORM[UV], 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // This is necessary for non-power-of-two textures glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Using BGRA extension to pull in video frame data directly glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, bufferWidth/2, bufferHeight/2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, CVPixelBufferGetBaseAddressOfPlane(cameraFrame, 1)); [self drawFrame]; glDeleteTextures(1, &amp;_lumaTexture); glDeleteTextures(1, &amp;_chromaTexture); CVPixelBufferUnlockBaseAddress(cameraFrame, 0); </code></pre> <p>How can I fix this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload