diff options
author | Sascha Haeberling <haeberling@google.com> | 2013-08-14 11:20:34 -0700 |
---|---|---|
committer | Sascha Haeberling <haeberling@google.com> | 2013-08-14 11:20:34 -0700 |
commit | 8bddf8ce4f3dcbb56edb12cee7e93f3a9daa3f96 (patch) | |
tree | 3382b4b8b52be577c3d0525df0e7da8178673d1c /jni/feature_mos/src/mosaic_renderer/Renderer.h | |
parent | a34e8c7d439d17355df51e5e536bdbbd1744cc74 (diff) | |
download | android_packages_apps_Snap-8bddf8ce4f3dcbb56edb12cee7e93f3a9daa3f96.tar.gz android_packages_apps_Snap-8bddf8ce4f3dcbb56edb12cee7e93f3a9daa3f96.tar.bz2 android_packages_apps_Snap-8bddf8ce4f3dcbb56edb12cee7e93f3a9daa3f96.zip |
Copy over libjni_mosaic from Camera. We need to support the SRI pano
mode for Carlsbad.
Change-Id: Id14e64d8248236e8170c12cfca2cbf2ca952e993
Diffstat (limited to 'jni/feature_mos/src/mosaic_renderer/Renderer.h')
-rwxr-xr-x | jni/feature_mos/src/mosaic_renderer/Renderer.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/jni/feature_mos/src/mosaic_renderer/Renderer.h b/jni/feature_mos/src/mosaic_renderer/Renderer.h new file mode 100755 index 000000000..a43e8028e --- /dev/null +++ b/jni/feature_mos/src/mosaic_renderer/Renderer.h @@ -0,0 +1,65 @@ +#pragma once + +#include "FrameBuffer.h" + +#include <GLES2/gl2.h> + +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> + +class Renderer { + public: + Renderer(); + virtual ~Renderer(); + + // Initialize OpenGL resources + // @return true if successful + virtual bool InitializeGLProgram() = 0; + + bool SetupGraphics(FrameBuffer* buffer); + bool SetupGraphics(int width, int height); + + bool Clear(float r, float g, float b, float a); + + int GetTextureName(); + void SetInputTextureName(GLuint textureName); + void SetInputTextureDimensions(int width, int height); + void SetInputTextureType(GLenum textureType); + + void InitializeGLContext(); + + protected: + + GLuint loadShader(GLenum shaderType, const char* pSource); + GLuint createProgram(const char*, const char* ); + + int SurfaceWidth() const { return mSurfaceWidth; } + int SurfaceHeight() const { return mSurfaceHeight; } + + // Source code for shaders. + virtual const char* VertexShaderSource() const = 0; + virtual const char* FragmentShaderSource() const = 0; + + // Redefine this to use special texture types such as + // GL_TEXTURE_EXTERNAL_OES. + GLenum InputTextureType() const { return mInputTextureType; } + + GLuint mGlProgram; + GLuint mInputTextureName; + GLenum mInputTextureType; + int mInputTextureWidth; + int mInputTextureHeight; + + // Attribute locations + GLint mScalingtransLoc; + GLint maPositionHandle; + GLint maTextureHandle; + + + int mSurfaceWidth; // Width of target surface. + int mSurfaceHeight; // Height of target surface. + + FrameBuffer *mFrameBuffer; +}; + |