2 * Copyright (C) 2010 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef ANDROID_SF_GLEXTENSION_H
18 #define ANDROID_SF_GLEXTENSION_H
21 #include <sys/types.h>
23 #include <utils/String8.h>
24 #include <utils/SortedVector.h>
25 #include <utils/Singleton.h>
28 #include <EGL/eglext.h>
30 #include <GLES/glext.h>
33 // ---------------------------------------------------------------------------
35 class GLExtensions : public Singleton<GLExtensions>
37 friend class Singleton<GLExtensions>;
39 bool mHaveTextureExternal : 1;
41 bool mHaveDirectTexture : 1;
42 bool mHaveFramebufferObject : 1;
50 String8 mEglExtensions;
51 SortedVector<String8> mExtensionList;
53 GLExtensions(const GLExtensions&);
54 GLExtensions& operator = (const GLExtensions&);
60 inline bool haveTextureExternal() const {
61 return mHaveTextureExternal;
63 inline bool haveNpot() const {
66 inline bool haveDirectTexture() const {
67 return mHaveDirectTexture;
70 inline bool haveFramebufferObject() const {
71 return mHaveFramebufferObject;
74 void initWithGLStrings(
75 GLubyte const* vendor,
76 GLubyte const* renderer,
77 GLubyte const* version,
78 GLubyte const* extensions,
79 char const* egl_vendor,
80 char const* egl_version,
81 char const* egl_extensions);
83 char const* getVendor() const;
84 char const* getRenderer() const;
85 char const* getVersion() const;
86 char const* getExtension() const;
88 char const* getEglVendor() const;
89 char const* getEglVersion() const;
90 char const* getEglExtension() const;
92 bool hasExtension(char const* extension) const;
96 // ---------------------------------------------------------------------------
97 }; // namespace android
99 #endif // ANDROID_SF_GLEXTENSION_H