/* RetroArch - A frontend for libretro. * Copyright (C) 2010-2012 - Hans-Kristian Arntzen * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with RetroArch. * If not, see . */ #ifndef __GL_COMMON_H #define __GL_COMMON_H #include "../general.h" #ifdef HAVE_CONFIG_H #include "../config.h" #endif #if defined(__APPLE__) #include #include #elif defined(__CELLOS_LV2__) #include #include #include #else #define GL_GLEXT_PROTOTYPES #include #include #endif static inline bool gl_check_error(void) { int error = glGetError(); switch (error) { case GL_INVALID_ENUM: RARCH_ERR("GL: Invalid enum.\n"); break; case GL_INVALID_VALUE: RARCH_ERR("GL: Invalid value. (You're not alone.)\n"); break; case GL_INVALID_OPERATION: RARCH_ERR("GL: Invalid operation.\n"); break; case GL_STACK_OVERFLOW: RARCH_ERR("GL: Stack overflow. (wtf)\n"); break; case GL_STACK_UNDERFLOW: RARCH_ERR("GL: Stack underflow. (:v)\n"); break; case GL_OUT_OF_MEMORY: RARCH_ERR("GL: Out of memory. Harhar.\n"); break; case GL_NO_ERROR: return true; default: RARCH_ERR("Non specified error :v\n"); } return false; } struct gl_fbo_rect { unsigned img_width; unsigned img_height; unsigned max_img_width; unsigned max_img_height; unsigned width; unsigned height; }; enum gl_scale_type { RARCH_SCALE_ABSOLUTE, RARCH_SCALE_INPUT, RARCH_SCALE_VIEWPORT }; struct gl_fbo_scale { enum gl_scale_type type_x; enum gl_scale_type type_y; float scale_x; float scale_y; unsigned abs_x; unsigned abs_y; bool valid; }; struct gl_tex_info { GLuint tex; GLfloat input_size[2]; GLfloat tex_size[2]; GLfloat coord[8]; }; // Windows ... <_< #if (defined(HAVE_XML) || defined(HAVE_CG)) && defined(_WIN32) extern PFNGLCLIENTACTIVETEXTUREPROC pglClientActiveTexture; extern PFNGLACTIVETEXTUREPROC pglActiveTexture; #else #define pglClientActiveTexture glClientActiveTexture #define pglActiveTexture glActiveTexture #endif void rarch_gl_set_vsync(unsigned enabled); #endif