BsGLPrerequisites.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 <OpenGL/gl3.h>
  37. # include <OpenGL/gl3ext.h>
  38. #endif
  39. #if BS_THREAD_SUPPORT == 1
  40. GLEWContext * glewGetContext();
  41. # if BS_PLATFORM == BS_PLATFORM_WIN32
  42. WGLEWContext * wglewGetContext();
  43. # endif
  44. #endif
  45. // Lots of generated code in here which triggers the new VC CRT security warnings
  46. #if !defined( _CRT_SECURE_NO_DEPRECATE )
  47. #define _CRT_SECURE_NO_DEPRECATE
  48. #endif
  49. /** @addtogroup Plugins
  50. * @{
  51. */
  52. /** @defgroup GL BansheeGLRenderAPI
  53. * Wrapper around the OpenGL render API.
  54. */
  55. /** @} */
  56. namespace bs { namespace ct
  57. {
  58. /** Translated an OpenGL error code enum to an error code string. */
  59. const char* bs_get_gl_error_string(GLenum errorCode);
  60. /** Checks if there have been any OpenGL errors since the last call, and if so reports them. */
  61. void bs_check_gl_error(const char* function, const char* file, INT32 line);
  62. #if BS_DEBUG_MODE && (!BS_OPENGL_4_3 && !BS_OPENGLES_3_2)
  63. #define BS_CHECK_GL_ERROR() bs_check_gl_error(__PRETTY_FUNCTION__, __FILE__,__LINE__)
  64. #else
  65. #define BS_CHECK_GL_ERROR()
  66. #endif
  67. extern const char* MODULE_NAME;
  68. class GLSupport;
  69. class GLRenderAPI;
  70. class GLTexture;
  71. class GLVertexBuffer;
  72. class GLContext;
  73. class GLRTTManager;
  74. class GLPixelBuffer;
  75. class GLGpuParamBlock;
  76. class GLSLGpuProgram;
  77. class GLVertexArrayObject;
  78. struct GLSLProgramPipeline;
  79. class GLSLProgramPipelineManager;
  80. class GLTextureView;
  81. /** @addtogroup GL
  82. * @{
  83. */
  84. /** OpenGL specific types to track resource statistics for. */
  85. enum GLRenderStatResourceType
  86. {
  87. RenderStatObject_PipelineObject = 100,
  88. RenderStatObject_FrameBufferObject,
  89. RenderStatObject_VertexArrayObject
  90. };
  91. /** @} */
  92. }}