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 <stdio.h> | 5 #include <stdio.h> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 #include "main.h" | 9 #include "main.h" |
10 #include "xlib_window.h" | 10 #include "xlib_window.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 pixmap_(0), | 36 pixmap_(0), |
37 init_succeeded(false) {} | 37 init_succeeded(false) {} |
38 | 38 |
39 | 39 |
40 bool PixmapToTextureTest::InitNative() { | 40 bool PixmapToTextureTest::InitNative() { |
41 int major = 0; | 41 int major = 0; |
42 int minor = 0; | 42 int minor = 0; |
43 if (!glXQueryVersion(g_xlib_display, &major, &minor)) | 43 if (!glXQueryVersion(g_xlib_display, &major, &minor)) |
44 return false; | 44 return false; |
45 | 45 |
46 if (major < 1 || (major == 1 && minor < 3)) | 46 if (major < 1 || (major == 1 && minor < 3)) { |
| 47 printf("# GLX 1.3 required for pixmap to texture extension.\n"); |
47 return false; | 48 return false; |
| 49 } |
48 | 50 |
49 if (!glXBindTexImageEXT) | 51 if (!glXBindTexImageEXT) |
50 return false; | 52 return false; |
51 | 53 |
52 pixmap_ = AllocatePixmap(); | 54 pixmap_ = AllocatePixmap(); |
53 | 55 |
54 int rgba, rgb; | 56 int rgba, rgb; |
55 glXGetFBConfigAttrib(g_xlib_display, g_glx_fbconfig, | 57 glXGetFBConfigAttrib(g_xlib_display, g_glx_fbconfig, |
56 GLX_BIND_TO_TEXTURE_RGBA_EXT, &rgba); | 58 GLX_BIND_TO_TEXTURE_RGBA_EXT, &rgba); |
57 glXGetFBConfigAttrib(g_xlib_display, g_glx_fbconfig, | 59 glXGetFBConfigAttrib(g_xlib_display, g_glx_fbconfig, |
(...skipping 30 matching lines...) Expand all Loading... |
88 return true; | 90 return true; |
89 } | 91 } |
90 | 92 |
91 | 93 |
92 void PixmapToTextureTest::Stop() { | 94 void PixmapToTextureTest::Stop() { |
93 glXReleaseTexImageEXT(g_xlib_display, glxpixmap_, GLX_FRONT_LEFT_EXT); | 95 glXReleaseTexImageEXT(g_xlib_display, glxpixmap_, GLX_FRONT_LEFT_EXT); |
94 glFinish(); | 96 glFinish(); |
95 glXDestroyPixmap(g_xlib_display, glxpixmap_); | 97 glXDestroyPixmap(g_xlib_display, glxpixmap_); |
96 XFreePixmap(g_xlib_display, pixmap_); | 98 XFreePixmap(g_xlib_display, pixmap_); |
97 } | 99 } |
OLD | NEW |