| 1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
| 2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
| 3 | #pragma once |
| 4 | |
| 5 | #include "BsCorePrerequisites.h" |
| 6 | |
| 7 | #if BS_THREAD_SUPPORT == 1 |
| 8 | # define GLEW_MX |
| 9 | #endif |
| 10 | |
| 11 | // 4.1 is the minimum supported version for OpenGL |
| 12 | #define BS_OPENGL_4_1 1 |
| 13 | |
| 14 | #if BS_PLATFORM != BS_PLATFORM_OSX |
| 15 | #define BS_OPENGL_4_2 1 |
| 16 | #define BS_OPENGL_4_3 1 |
| 17 | #define BS_OPENGL_4_4 1 |
| 18 | #define BS_OPENGL_4_5 1 |
| 19 | #define BS_OPENGL_4_6 0 |
| 20 | #endif |
| 21 | |
| 22 | // 3.1 is the minimum supported version for OpenGL ES |
| 23 | #define BS_OPENGLES_3_1 0 |
| 24 | #define BS_OPENGLES_3_2 0 |
| 25 | |
| 26 | #if BS_PLATFORM == BS_PLATFORM_WIN32 |
| 27 | #if !defined( __MINGW32__ ) |
| 28 | # define WIN32_LEAN_AND_MEAN |
| 29 | # ifndef NOMINMAX |
| 30 | # define NOMINMAX // required to stop windows.h messing up std::min |
| 31 | # endif |
| 32 | #endif |
| 33 | # include <windows.h> |
| 34 | # include <wingdi.h> |
| 35 | # include <GL/glew.h> |
| 36 | # include <GL/wglew.h> |
| 37 | #elif BS_PLATFORM == BS_PLATFORM_LINUX |
| 38 | # include <GL/glew.h> |
| 39 | # include <GL/glu.h> |
| 40 | # define GL_GLEXT_PROTOTYPES |
| 41 | #elif BS_PLATFORM == BS_PLATFORM_OSX |
| 42 | #define GL_SILENCE_DEPRECATION 1 |
| 43 | #include <OpenGL/gl3.h> |
| 44 | #include <OpenGL/gl3ext.h> |
| 45 | #endif |
| 46 | |
| 47 | #if BS_THREAD_SUPPORT == 1 |
| 48 | GLEWContext * glewGetContext(); |
| 49 | |
| 50 | # if BS_PLATFORM == BS_PLATFORM_WIN32 |
| 51 | WGLEWContext * wglewGetContext(); |
| 52 | # endif |
| 53 | |
| 54 | #endif |
| 55 | |
| 56 | // Lots of generated code in here which triggers the new VC CRT security warnings |
| 57 | #if !defined( _CRT_SECURE_NO_DEPRECATE ) |
| 58 | #define _CRT_SECURE_NO_DEPRECATE |
| 59 | #endif |
| 60 | |
| 61 | /** @addtogroup Plugins |
| 62 | * @{ |
| 63 | */ |
| 64 | |
| 65 | /** @defgroup GL bsfGLRenderAPI |
| 66 | * Wrapper around the OpenGL render API. |
| 67 | */ |
| 68 | |
| 69 | /** @} */ |
| 70 | |
| 71 | namespace bs { namespace ct |
| 72 | { |
| 73 | /** Translated an OpenGL error code enum to an error code string. */ |
| 74 | const char* bs_get_gl_error_string(GLenum errorCode); |
| 75 | |
| 76 | /** Checks if there have been any OpenGL errors since the last call, and if so reports them. */ |
| 77 | void bs_check_gl_error(const char* function, const char* file, INT32 line); |
| 78 | |
| 79 | #if BS_DEBUG_MODE && (!BS_OPENGL_4_3 && !BS_OPENGLES_3_2) |
| 80 | #define BS_CHECK_GL_ERROR() bs_check_gl_error(__PRETTY_FUNCTION__, __FILE__,__LINE__) |
| 81 | #else |
| 82 | #define BS_CHECK_GL_ERROR() |
| 83 | #endif |
| 84 | |
| 85 | extern const char* MODULE_NAME; |
| 86 | |
| 87 | class GLSupport; |
| 88 | class GLRenderAPI; |
| 89 | class GLTexture; |
| 90 | class GLVertexBuffer; |
| 91 | class GLContext; |
| 92 | class GLRTTManager; |
| 93 | class GLPixelBuffer; |
| 94 | class GLGpuParamBlock; |
| 95 | class GLSLGpuProgram; |
| 96 | class GLVertexArrayObject; |
| 97 | struct GLSLProgramPipeline; |
| 98 | class GLSLProgramPipelineManager; |
| 99 | class GLTextureView; |
| 100 | |
| 101 | /** @addtogroup GL |
| 102 | * @{ |
| 103 | */ |
| 104 | |
| 105 | /** OpenGL specific types to track resource statistics for. */ |
| 106 | enum GLRenderStatResourceType |
| 107 | { |
| 108 | RenderStatObject_PipelineObject = 100, |
| 109 | RenderStatObject_FrameBufferObject, |
| 110 | RenderStatObject_VertexArrayObject |
| 111 | }; |
| 112 | |
| 113 | /** @} */ |
| 114 | }} |
| 115 | |