BsGLPrerequisites.h 2.7 KB

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