BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.21k stars 4.61k forks source link

Can I replace crosshair with UIImage? #2548

Open goldenmobile028 opened 6 years ago

goldenmobile028 commented 6 years ago

Hi Brad. How are you? I am using your GPUImage library in many projects and Thank you. Now I am using GPUImageCrosshairGenerator in the video filtering app. I can see crosshairs in the camera and it's working well.

I am just wondering if I replace the crosshair with UIImage. I tried so many times to replace the crosshairs but it won't working.

UIImage sparkleImage; GLuint sparkleName; GLubyte sparkleData;

sparkleName = [self setupTexture:@"sparkle"];

So I got the Texture info. And then I tried to change following method to replace the crosshairs with sparkleImage but it won't working.

if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE

else

    glEnable(GL_POINT_SPRITE);
    glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);

endif

    outputFramebuffer = [[GPUImageContext sharedFramebufferCache] fetchFramebufferForSize:[self sizeOfFBO] textureOptions:self.outputTextureOptions onlyTexture:NO];
    [outputFramebuffer activateFramebuffer];

    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glVertexAttribPointer(filterPositionAttribute, 2, GL_FLOAT, 0, 0, crosshairCoordinates);
    glDrawArrays(GL_POINTS, 0, (GLsizei)numberOfCrosshairs);

    [self informTargetsAboutNewFrameAtTime:frameTime];
});

}

Can you please help me to edit the above method? I will appreciate for your help.

Kind Regards. Hua.

cuhte3 commented 6 years ago

@goldenmobile028 I'm trying to achieve the same, did you succeed with modifying crosshair generator?