| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium 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 // This file implements a standalone executable demo of using GLES2 over | 5 // This file implements a standalone executable demo of using GLES2 over |
| 6 // command buffers. This code is temporary as the setup that happens | 6 // command buffers. This code is temporary as the setup that happens |
| 7 // here is in a state of flux. Eventually there will be several versions of | 7 // here is in a state of flux. Eventually there will be several versions of |
| 8 // setup, one for trusted code, one for pepper, one for NaCl, and maybe others. | 8 // setup, one for trusted code, one for pepper, one for NaCl, and maybe others. |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (!transfer_buffer.ptr) | 76 if (!transfer_buffer.ptr) |
| 77 return false; | 77 return false; |
| 78 | 78 |
| 79 | 79 |
| 80 gles2::Initialize(); | 80 gles2::Initialize(); |
| 81 gles2::SetGLContext(new GLES2Implementation(helper, | 81 gles2::SetGLContext(new GLES2Implementation(helper, |
| 82 transfer_buffer.size, | 82 transfer_buffer.size, |
| 83 transfer_buffer.ptr, | 83 transfer_buffer.ptr, |
| 84 transfer_buffer_id)); | 84 transfer_buffer_id)); |
| 85 | 85 |
| 86 GLFromCPPInit(); |
| 87 |
| 86 return command_buffer.release() != NULL; | 88 return command_buffer.release() != NULL; |
| 87 } | 89 } |
| 88 | 90 |
| 89 #if defined(OS_WIN) | 91 #if defined(OS_WIN) |
| 90 LRESULT CALLBACK WindowProc( | 92 LRESULT CALLBACK WindowProc( |
| 91 HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param) { | 93 HWND hwnd, UINT msg, WPARAM w_param, LPARAM l_param) { |
| 92 switch (msg) { | 94 switch (msg) { |
| 93 case WM_CLOSE: | 95 case WM_CLOSE: |
| 94 DestroyWindow(hwnd); | 96 DestroyWindow(hwnd); |
| 95 break; | 97 break; |
| 96 case WM_DESTROY: | 98 case WM_DESTROY: |
| 97 PostQuitMessage(0); | 99 PostQuitMessage(0); |
| 98 break; | 100 break; |
| 99 case WM_PAINT: { | 101 case WM_PAINT: { |
| 100 GLFromCPPTestFunction(); | 102 GLFromCPPDraw(); |
| 101 GLFromCTestFunction(); | 103 GLFromCDraw(); |
| 102 // TODO(gman): Not sure how SwapBuffer should be exposed. | 104 // TODO(gman): Not sure how SwapBuffer should be exposed. |
| 103 gles2::GetGLContext()->SwapBuffers(); | 105 gles2::GetGLContext()->SwapBuffers(); |
| 104 break; | 106 break; |
| 105 } | 107 } |
| 106 default: | 108 default: |
| 107 return ::DefWindowProc(hwnd, msg, w_param, l_param); | 109 return ::DefWindowProc(hwnd, msg, w_param, l_param); |
| 108 } | 110 } |
| 109 return 0; | 111 return 0; |
| 110 } | 112 } |
| 111 | 113 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 206 } |
| 205 | 207 |
| 206 demo->Setup(hwnd, kCommandBufferSize); | 208 demo->Setup(hwnd, kCommandBufferSize); |
| 207 | 209 |
| 208 ProcessMessages(hwnd); | 210 ProcessMessages(hwnd); |
| 209 | 211 |
| 210 return EXIT_SUCCESS; | 212 return EXIT_SUCCESS; |
| 211 } | 213 } |
| 212 | 214 |
| 213 | 215 |
| OLD | NEW |