23 "attribute vec4 vertex;\n" 24 "attribute vec2 inputTextureCoordinate;\n" 25 "varying vec2 textureCoordinate;\n" 28 " gl_Position = mvp*vertex;\n" 29 " textureCoordinate = inputTextureCoordinate.xy;\n" 33 "varying vec2 textureCoordinate;\n" 34 "uniform sampler2D inputTexture;\n" 36 " gl_FragColor = texture2D(inputTexture, textureCoordinate);\n" 39 static const float vertices[] = {-0.5f, -0.5f, 0.5f, -0.5f,
40 -0.5f, 0.5f, 0.5f, 0.5f};
43 0.0f, 0.0f, 1.0f, 0.0f, };
48 LOGE(
"Could not create program.");
64 glEnable(GL_CULL_FACE);
66 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
74 glm::mat4 mvp_mat = projection_mat * view_mat * model_mat;
80 glBindBuffer(GL_ARRAY_BUFFER, 0);
86 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
88 glBindTexture(GL_TEXTURE_2D, 0);
static const float vertices[]
static const char kFragmentShader[]
static const GLfloat texture_coords[]
GLuint CreateProgram(const char *vertex_source, const char *fragment_source)
void SetTextureId(GLuint texture_id)
GLM_FUNC_DECL genType::value_type const * value_ptr(genType const &vec)
void glUniformMatrix4fv(GLuint, int, int, float *)
static const char kVertexShader[]
void Render(const glm::mat4 &projection_mat, const glm::mat4 &view_mat) const