BsGLPrerequisites.h 2.7 KB

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