OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <gflags/gflags.h> | 5 #include <gflags/gflags.h> |
6 #include <map> | 6 #include <map> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <time.h> | 10 #include <time.h> |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 GLuint texture = GenerateAndBindTexture(); | 185 GLuint texture = GenerateAndBindTexture(); |
186 | 186 |
187 GLfloat vertices[8] = { | 187 GLfloat vertices[8] = { |
188 0.f, 0.f, | 188 0.f, 0.f, |
189 1.f, 0.f, | 189 1.f, 0.f, |
190 0.f, 1.f, | 190 0.f, 1.f, |
191 1.f, 1.f, | 191 1.f, 1.f, |
192 }; | 192 }; |
193 | 193 |
194 GLuint program = InitShaderProgram(vertex_shader, fragment_shader); | 194 GLuint program = glbench::InitShaderProgram(vertex_shader, fragment_shader); |
195 int attribute_index = glGetAttribLocation(program, "c"); | 195 int attribute_index = glGetAttribLocation(program, "c"); |
196 glVertexAttribPointer(attribute_index, 2, GL_FLOAT, GL_FALSE, 0, vertices); | 196 glVertexAttribPointer(attribute_index, 2, GL_FLOAT, GL_FALSE, 0, vertices); |
197 glEnableVertexAttribArray(attribute_index); | 197 glEnableVertexAttribArray(attribute_index); |
198 | 198 |
199 int texture_sampler = glGetUniformLocation(program, "tex"); | 199 int texture_sampler = glGetUniformLocation(program, "tex"); |
200 glUniform1f(texture_sampler, 0); | 200 glUniform1f(texture_sampler, 0); |
201 | 201 |
202 // UniformTest needs a uniform from the shader program. Get the uniform | 202 // UniformTest needs a uniform from the shader program. Get the uniform |
203 // and instantiate the test. | 203 // and instantiate the test. |
204 Test* uniform_test = GetUniformTest(glGetUniformLocation(program, "shift")); | 204 Test* uniform_test = GetUniformTest(glGetUniformLocation(program, "shift")); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 t->Stop(); | 252 t->Stop(); |
253 } | 253 } |
254 | 254 |
255 // TODO: cleaner teardown. | 255 // TODO: cleaner teardown. |
256 | 256 |
257 glDeleteTextures(1, &texture); | 257 glDeleteTextures(1, &texture); |
258 DestroyContext(); | 258 DestroyContext(); |
259 return return_code; | 259 return return_code; |
260 } | 260 } |
OLD | NEW |