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 <EGL/egl.h> | 5 #include <EGL/egl.h> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "main.h" | 8 #include "main.h" |
9 #include "xlib_window.h" | 9 #include "xlib_window.h" |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 EGLContext egl_context = eglCreateContext(egl_display, egl_config, | 76 EGLContext egl_context = eglCreateContext(egl_display, egl_config, |
77 NULL, NULL); | 77 NULL, NULL); |
78 CHECK_EGL(); | 78 CHECK_EGL(); |
79 | 79 |
80 eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context); | 80 eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context); |
81 CHECK_EGL(); | 81 CHECK_EGL(); |
82 | 82 |
83 eglQuerySurface(egl_display, egl_surface, EGL_WIDTH, &g_width); | 83 eglQuerySurface(egl_display, egl_surface, EGL_WIDTH, &g_width); |
84 eglQuerySurface(egl_display, egl_surface, EGL_HEIGHT, &g_height); | 84 eglQuerySurface(egl_display, egl_surface, EGL_HEIGHT, &g_height); |
85 | 85 |
| 86 #ifndef USE_EGL |
86 glMatrixMode(GL_MODELVIEW); | 87 glMatrixMode(GL_MODELVIEW); |
87 glLoadIdentity(); | 88 glLoadIdentity(); |
| 89 #endif |
88 | 90 |
89 return true; | 91 return true; |
90 } | 92 } |
91 | 93 |
92 void DestroyContext() { | 94 void DestroyContext() { |
93 eglMakeCurrent(egl_display, NULL, NULL, NULL); | 95 eglMakeCurrent(egl_display, NULL, NULL, NULL); |
94 eglDestroyContext(egl_display, egl_context); | 96 eglDestroyContext(egl_display, egl_context); |
95 } | 97 } |
96 | 98 |
97 void TerminateGL() { | 99 void TerminateGL() { |
98 eglDestroySurface(egl_display, egl_surface); | 100 eglDestroySurface(egl_display, egl_surface); |
99 eglTerminate(egl_display); | 101 eglTerminate(egl_display); |
100 } | 102 } |
101 | 103 |
102 void SwapBuffers() { | 104 void SwapBuffers() { |
103 eglSwapBuffers(egl_display, egl_surface); | 105 eglSwapBuffers(egl_display, egl_surface); |
104 } | 106 } |
105 | 107 |
106 bool SwapInterval(int interval) { | 108 bool SwapInterval(int interval) { |
107 return eglSwapInterval(egl_display, interval) == EGL_TRUE; | 109 return eglSwapInterval(egl_display, interval) == EGL_TRUE; |
108 } | 110 } |
OLD | NEW |