BsGLPrerequisites.h 2.7 KB

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