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
12class WarpRenderer: public Renderer {
13  public:
14    WarpRenderer();
15    virtual ~WarpRenderer();
16
17    // Initialize OpenGL resources
18    // @return true if successful
19    bool InitializeGLProgram();
20
21    void SetViewportMatrix(int w, int h, int W, int H);
22    void SetScalingMatrix(float xscale, float yscale);
23
24    bool DrawTexture(GLfloat *affine);
25
26 private:
27    // Source code for shaders.
28    const char* VertexShaderSource() const;
29    const char* FragmentShaderSource() const;
30
31    GLuint mTexHandle;                  // Handle to s_texture.
32    GLuint mTexCoordHandle;             // Handle to a_texCoord.
33    GLuint mTriangleVerticesHandle;     // Handle to vPosition.
34
35    // Attribute locations
36    GLint  mPositionLoc;
37    GLint  mAffinetransLoc;
38    GLint  mViewporttransLoc;
39    GLint  mScalingtransLoc;
40    GLint  mTexCoordLoc;
41
42    GLfloat mViewportMatrix[16];
43    GLfloat mScalingMatrix[16];
44
45    // Sampler location
46    GLint mSamplerLoc;
47};
48
49