Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.1 KiB

  1. //============ Copyright (c) Valve Corporation, All rights reserved. ============
  2. //
  3. // cglmfbo.h
  4. // GLMgr FBO's (render targets)
  5. //
  6. //===============================================================================
  7. #ifndef CGLMFBO_H
  8. #define CGLMFBO_H
  9. #pragma once
  10. // good FBO references / recaps
  11. // http://www.songho.ca/opengl/gl_fbo.html
  12. // http://www.gamedev.net/reference/articles/article2331.asp
  13. // ext links
  14. // http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt
  15. // http://www.opengl.org/registry/specs/EXT/framebuffer_multisample.txt
  16. //===============================================================================
  17. // tokens not in the SDK headers
  18. #ifndef GL_DEPTH_STENCIL_ATTACHMENT_EXT
  19. #define GL_DEPTH_STENCIL_ATTACHMENT_EXT 0x84F9
  20. #endif
  21. //===============================================================================
  22. // forward declarations
  23. class GLMContext;
  24. enum EGLMFBOAttachment
  25. {
  26. kAttColor0, kAttColor1, kAttColor2, kAttColor3,
  27. kAttDepth, kAttStencil, kAttDepthStencil,
  28. kAttCount
  29. };
  30. struct GLMFBOTexAttachParams
  31. {
  32. CGLMTex *m_tex;
  33. int m_face; // keep zero if not cube map
  34. int m_mip; // keep zero if notmip mapped
  35. int m_zslice; // keep zero if not a 3D tex
  36. };
  37. class CGLMFBO
  38. {
  39. friend class GLMContext;
  40. friend class GLMTester;
  41. friend class CGLMTex;
  42. friend struct IDirect3D9;
  43. friend struct IDirect3DDevice9;
  44. public:
  45. CGLMFBO( GLMContext *ctx );
  46. ~CGLMFBO( );
  47. protected:
  48. void TexAttach( GLMFBOTexAttachParams *params, EGLMFBOAttachment attachIndex, GLenum fboBindPoint = GL_FRAMEBUFFER_EXT );
  49. void TexDetach( EGLMFBOAttachment attachIndex, GLenum fboBindPoint = GL_FRAMEBUFFER_EXT );
  50. // you can also pass GL_READ_FRAMEBUFFER_EXT or GL_DRAW_FRAMEBUFFER_EXT to selectively bind the receiving FBO to one or the other.
  51. void TexScrub( CGLMTex *tex );
  52. // search and destroy any attachment for the named texture
  53. bool IsReady( void ); // aka FBO completeness check - ready to draw
  54. GLMContext *m_ctx; // link back to parent context
  55. GLuint m_name; // name of this FBO in the context
  56. GLMFBOTexAttachParams m_attach[ kAttCount ]; // indexed by EGLMFBOAttachment
  57. };
  58. #endif