1 /* 2 * Copyright 2018 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_OGL_H 18 #define ANDROID_OGL_H 19 20 #include <assert.h> 21 22 struct ScreenColor { 23 float red; 24 float green; 25 float blue; 26 float alpha; 27 }; 28 29 constexpr ScreenColor RED { 1.0f, 0.0f, 0.0f, 1.0f }; 30 constexpr ScreenColor GREEN { 0.0f, 1.0f, 0.0f, 1.0f }; 31 constexpr ScreenColor BLUE { 0.0f, 0.0f, 1.0f, 1.0f }; 32 constexpr ScreenColor PURPLE { 1.0f, 0.0f, 1.0f, 1.0f }; 33 constexpr ScreenColor ORANGE { 1.0f, 0.5f, 0.0f, 1.0f }; 34 constexpr ScreenColor GREY { 0.3f, 0.3f, 0.3f, 0.3f }; 35 constexpr ScreenColor YELLOW { 1.0f, 1.0f, 0.0f, 1.0f }; 36 37 #ifdef GL3 38 #include <GLES3/gl3.h> 39 #elif GL3_2 40 #include <GLES3/gl32.h> 41 #else 42 #include <GLES2/gl2.h> 43 #include <GLES2/gl2ext.h> 44 #endif 45 46 void CheckOpenGLError(const char* stmt, const char* fname, int line); 47 48 #ifndef NDEBUG 49 #define GL_CHECK(stmt) \ 50 stmt;\ 51 CheckOpenGLError(#stmt, __FILE__, __LINE__); 52 #else 53 #define GL_CHECK(stmt) stmt 54 #endif 55 56 void SetGLScreenColor(ScreenColor color); 57 58 #endif //ANDROID_OGL_H 59