OpenGL.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /**
  2. * Copyright (c) 2006-2012 LOVE Development Team
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. * 2. Altered source versions must be plainly marked as such, and must not be
  17. * misrepresented as being the original software.
  18. * 3. This notice may not be removed or altered from any source distribution.
  19. **/
  20. #ifndef LOVE_GRAPHICS_OPENGL_OPENGL_H
  21. #define LOVE_GRAPHICS_OPENGL_OPENGL_H
  22. #include "GLee.h"
  23. #include "graphics/Image.h"
  24. namespace love
  25. {
  26. namespace graphics
  27. {
  28. namespace opengl
  29. {
  30. /**
  31. * Initializes some required context state,
  32. * based on current and default OpenGL state.
  33. **/
  34. void initializeContext();
  35. /**
  36. * Marks current context state as invalid.
  37. **/
  38. void uninitializeContext();
  39. /**
  40. * Helper for setting the active texture unit.
  41. *
  42. * @param textureunit Index in the range of [0, maxtextureunits-1]
  43. **/
  44. void setActiveTextureUnit(int textureunit);
  45. /**
  46. * Helper for binding an OpenGL texture.
  47. * Makes sure we aren't redundantly binding textures.
  48. **/
  49. void bindTexture(GLuint texture);
  50. /**
  51. * Helper for binding a texture to a specific texture unit.
  52. *
  53. * @param textureunit Index in the range of [0, maxtextureunits-1]
  54. * @param resoreprev Restore previously bound texture unit when done.
  55. **/
  56. void bindTextureToUnit(GLuint texture, int textureunit, bool restoreprev);
  57. /**
  58. * Helper for deleting an OpenGL texture.
  59. * Cleans up if the texture is currently bound.
  60. **/
  61. void deleteTexture(GLuint texture);
  62. /**
  63. * Sets the image filter mode for the currently bound texture.
  64. */
  65. void setTextureFilter(const graphics::Image::Filter &f);
  66. /**
  67. * Returns the image filter mode for the currently bound texture.
  68. */
  69. graphics::Image::Filter getTextureFilter();
  70. /**
  71. * Sets the image wrap mode for the currently bound texture.
  72. */
  73. void setTextureWrap(const graphics::Image::Wrap &w);
  74. /**
  75. * Returns the image wrap mode for the currently bound texture.
  76. */
  77. graphics::Image::Wrap getTextureWrap();
  78. } // opengl
  79. } // graphics
  80. } // love
  81. #endif