ShaderCam | Demo app to discuss rendering camera frame using OpenGL ES
kandi X-RAY | ShaderCam Summary
kandi X-RAY | ShaderCam Summary
##Shader Camera By LittleCheeseCake. Occasionally I receives emails asking how to render Camera Frame using OpenGL ES on Android. I lazily used some codes from an open source project InstaCam without fully understand until recently I reviewed some fundamentals of OpenGL ES and re-impelemented a demo app for camera frame rendering using shaders. This post is to discuss some key aspects in the implementation and share the demo codes. ###CameraRenderer Drawing using OpenGL is implemented by rendering on GLSurfaceView. The common approach is subclass the GLSurfaceView and implements the GLSurfaceView.Renderer. The rendering tasks are performed by implementing the interface.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Called when the surface is created
- Deletes the shader program
- Loads string from rawId
- Compiles the shader source
- Sets the program
- Called when the surface is updated
- Initialize internal variables
- Returns the texture id for this texture
- Render the surface
- Use OpenGL
- Render a quad at the given position
- OnPause
- Destroy the surface
- Returns the indexes of the given names
- Get the handle for a named shader
- Initialize the camera
- Initialize the renderer
ShaderCam Key Features
ShaderCam Examples and Code Snippets
Community Discussions
Trending Discussions on ShaderCam
QUESTION
I am currently programming an application for image processing. To achieve the needed performance, I have to use the GPU to compute the camera input, more specifically use OpenGL ES 2.0. With the help of this project (https://github.com/yulu/ShaderCam) I achieved to pass the image to the pipeline and do simple operations with the fragment shader (like inverting colors etc).
My knowledge of GLSL, fragment shaders and vertex shaders is fairly limited but I am aware of pipeline constraints and what the two shaders do in the pipeline. So - formulating the problem - I would like to calculate the average color of a row in my received image and return it (per row) to my application. I read here https://stackoverflow.com/a/13866636/8038866 that this is generally possible, however I can't seem to find out the following things:
1 (edit: SOLVED by simply passing the w and h of my texture to the vertex and fragment shader): Knowing where the row ends (and having that information in the fragment shader). For this I assume that I would have to pass the width of the picture to the vertex shader and from there to the fragment shader, right?
2.: How to calculate the average the color values of each row in the fragment shader and then pass them to the application. If I understand it correctly - the fragment shader only excutes the code per pixel, so I am not sure how to achieve this.
Here are the two very basic shaders vertex shader:
...ANSWER
Answered 2017-Jun-11 at 13:34I found a way that does the trick for me. The idea is to calculate the mean for only one row of pixels and then later in the application to get this line with
glReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * data);
Here is my fragment shader (notice that the width of the surface is required as well):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ShaderCam
You can use ShaderCam like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the ShaderCam component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page