Home | History | Annotate | Download | only in mosaic_renderer
      1 #pragma once
      2 
      3 #include "FrameBuffer.h"
      4 #include "Renderer.h"
      5 
      6 #include <GLES2/gl2.h>
      7 
      8 #include <stdint.h>
      9 #include <stdio.h>
     10 #include <stdlib.h>
     11 
     12 class SurfaceTextureRenderer: public Renderer {
     13   public:
     14     SurfaceTextureRenderer();
     15     virtual ~SurfaceTextureRenderer();
     16 
     17     // Initialize OpenGL resources
     18     // @return true if successful
     19     bool InitializeGLProgram();
     20 
     21     bool DrawTexture(GLfloat *affine);
     22 
     23     void SetViewportMatrix(int w, int h, int W, int H);
     24     void SetScalingMatrix(float xscale, float yscale);
     25     void SetSTMatrix(float *stmat);
     26 
     27  private:
     28     // Source code for shaders.
     29     const char* VertexShaderSource() const;
     30     const char* FragmentShaderSource() const;
     31 
     32     // Attribute locations
     33     GLint  mScalingtransLoc;
     34     GLint muSTMatrixHandle;
     35     GLint maPositionHandle;
     36     GLint maTextureHandle;
     37 
     38     GLfloat mViewportMatrix[16];
     39     GLfloat mScalingMatrix[16];
     40 
     41     GLfloat mSTMatrix[16];
     42 
     43 };
     44 
     45