Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_SF_GLEXTENSION_H |
| 18 | #define ANDROID_SF_GLEXTENSION_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include <utils/String8.h> |
| 24 | #include <utils/SortedVector.h> |
| 25 | #include <utils/Singleton.h> |
| 26 | |
| 27 | #include <EGL/egl.h> |
| 28 | #include <EGL/eglext.h> |
| 29 | #include <GLES/gl.h> |
| 30 | #include <GLES/glext.h> |
| 31 | |
| 32 | namespace android { |
| 33 | // --------------------------------------------------------------------------- |
| 34 | |
| 35 | class GLExtensions : public Singleton<GLExtensions> |
| 36 | { |
| 37 | friend class Singleton<GLExtensions>; |
| 38 | |
Mathias Agopian | 1b0b30d | 2010-09-24 11:26:58 -0700 | [diff] [blame] | 39 | bool mHaveFramebufferObject : 1; |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 40 | |
| 41 | String8 mVendor; |
| 42 | String8 mRenderer; |
| 43 | String8 mVersion; |
| 44 | String8 mExtensions; |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 45 | SortedVector<String8> mExtensionList; |
| 46 | |
| 47 | GLExtensions(const GLExtensions&); |
| 48 | GLExtensions& operator = (const GLExtensions&); |
| 49 | |
| 50 | protected: |
| 51 | GLExtensions(); |
| 52 | |
| 53 | public: |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 54 | |
Mathias Agopian | 1b0b30d | 2010-09-24 11:26:58 -0700 | [diff] [blame] | 55 | inline bool haveFramebufferObject() const { |
| 56 | return mHaveFramebufferObject; |
| 57 | } |
| 58 | |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 59 | void initWithGLStrings( |
| 60 | GLubyte const* vendor, |
| 61 | GLubyte const* renderer, |
| 62 | GLubyte const* version, |
Mathias Agopian | 875d8e1 | 2013-06-07 15:35:48 -0700 | [diff] [blame^] | 63 | GLubyte const* extensions); |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 64 | |
| 65 | char const* getVendor() const; |
| 66 | char const* getRenderer() const; |
| 67 | char const* getVersion() const; |
| 68 | char const* getExtension() const; |
| 69 | |
Mathias Agopian | 1f7bec6 | 2010-06-25 18:02:21 -0700 | [diff] [blame] | 70 | bool hasExtension(char const* extension) const; |
| 71 | }; |
| 72 | |
| 73 | |
| 74 | // --------------------------------------------------------------------------- |
| 75 | }; // namespace android |
| 76 | |
| 77 | #endif // ANDROID_SF_GLEXTENSION_H |