Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: gpu/command_buffer/client/gles2_demo_cc.cc

Issue 566021: [GPU] GLES2 lost context recovery (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/gles2_demo_cc.h ('k') | gpu/command_buffer/client/gles2_lib.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/gles2_demo_cc.cc
===================================================================
--- gpu/command_buffer/client/gles2_demo_cc.cc (revision 37846)
+++ gpu/command_buffer/client/gles2_demo_cc.cc (working copy)
@@ -124,33 +124,6 @@
CheckGLError();
}
-void Draw() {
- // Note: the viewport is automatically set up to cover the entire Canvas.
- // Clear the color buffer
- glClear(GL_COLOR_BUFFER_BIT);
- CheckGLError();
- // Use the program object
- glUseProgram(g_programObject);
- CheckGLError();
- // Load the vertex data
- glBindBuffer(GL_ARRAY_BUFFER, g_vbo);
- glEnableVertexAttribArray(0);
- glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
- glEnableVertexAttribArray(1);
- glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0,
- reinterpret_cast<const void*>(g_texCoordOffset));
- CheckGLError();
- // Bind the texture to texture unit 0
- glBindTexture(GL_TEXTURE_2D, g_texture);
- CheckGLError();
- // Point the uniform sampler to texture unit 0
- glUniform1i(g_textureLoc, 0);
- CheckGLError();
- glDrawArrays(GL_TRIANGLES, 0, 6);
- CheckGLError();
- glFlush();
-}
-
GLuint CreateCheckerboardTexture() {
static unsigned char pixels[] = {
255, 255, 255,
@@ -171,19 +144,38 @@
return texture;
}
-void Init() {
+} // anonymous namespace.
+
+void GLFromCPPInit() {
glClearColor(0.f, 0.f, .7f, 1.f);
g_texture = CreateCheckerboardTexture();
InitShaders();
}
-} // anonymous namespace.
-
-void GLFromCPPTestFunction() {
- static bool initialized = false;
- if (!initialized) {
- initialized = true;
- Init();
- }
- Draw();
+void GLFromCPPDraw() {
+ // Note: the viewport is automatically set up to cover the entire Canvas.
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+ CheckGLError();
+ // Use the program object
+ glUseProgram(g_programObject);
+ CheckGLError();
+ // Load the vertex data
+ glBindBuffer(GL_ARRAY_BUFFER, g_vbo);
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
+ glEnableVertexAttribArray(1);
+ glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0,
+ reinterpret_cast<const void*>(g_texCoordOffset));
+ CheckGLError();
+ // Bind the texture to texture unit 0
+ glBindTexture(GL_TEXTURE_2D, g_texture);
+ CheckGLError();
+ // Point the uniform sampler to texture unit 0
+ glUniform1i(g_textureLoc, 0);
+ CheckGLError();
+ glDrawArrays(GL_TRIANGLES, 0, 6);
+ CheckGLError();
+ glFlush();
}
+
« no previous file with comments | « gpu/command_buffer/client/gles2_demo_cc.h ('k') | gpu/command_buffer/client/gles2_lib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698