OpenGL.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. GWEN
  3. Copyright (c) 2011 Facepunch Studios
  4. See license in Gwen.h
  5. */
  6. #ifndef GWEN_RENDERERS_OPENGL_H
  7. #define GWEN_RENDERERS_OPENGL_H
  8. #include "Gwen/Gwen.h"
  9. #include "Gwen/BaseRender.h"
  10. namespace Gwen
  11. {
  12. namespace Renderer
  13. {
  14. class OpenGL : public Gwen::Renderer::Base
  15. {
  16. public:
  17. struct Vertex
  18. {
  19. float x, y, z;
  20. float u, v;
  21. unsigned char r, g, b, a;
  22. };
  23. OpenGL();
  24. ~OpenGL();
  25. virtual void Begin();
  26. virtual void End();
  27. virtual void SetDrawColor( Gwen::Color color );
  28. virtual void DrawFilledRect( Gwen::Rect rect );
  29. void StartClip();
  30. void EndClip();
  31. void DrawTexturedRect( Gwen::Texture* pTexture, Gwen::Rect pTargetRect, float u1=0.0f, float v1=0.0f, float u2=1.0f, float v2=1.0f );
  32. void LoadTexture( Gwen::Texture* pTexture );
  33. void FreeTexture( Gwen::Texture* pTexture );
  34. protected:
  35. static const int MaxVerts = 1024;
  36. void Flush();
  37. void AddVert( int x, int y, float u = 0.0f , float v = 0.0f );
  38. Gwen::Color m_Color;
  39. int m_iVertNum;
  40. Vertex m_Vertices[ MaxVerts ];
  41. };
  42. }
  43. }
  44. #endif