Rev Author Line No. Line
1 ovan 1 #ifndef __OGL_CONTEXT_HEADER__
2 #define __OGL_CONTEXT_HEADER__
3  
6 ovan 4 #include "ogl.h"
1 ovan 5 #include "../context.h"
6  
7 namespace sleek
8 {
9     namespace driver
10     {
11         class ogl_context : public context
12         {
13             public:
14                 ogl_context(std::shared_ptr<device::Device>&, std::shared_ptr<context> shared = nullptr) noexcept;
15                 virtual ~ogl_context() noexcept;
16  
17                 virtual RENDER_CONTEXT getType() const noexcept
18                 {
19                     return RCTX_OGL3;
20                 }
21  
22                 virtual std::shared_ptr<driver> createDriver() noexcept;
23                 virtual std::shared_ptr<texture> createScreenshot(const math::aabbox2du&) const noexcept;
24  
25                 virtual std::shared_ptr<identifier> createTexture(texture *o, bool dsa = true) const noexcept;
26                 virtual std::shared_ptr<identifier> createTextureArray(texture_array*, bool dsa = true) const noexcept;
27                 virtual std::shared_ptr<identifier> createTexture3d(texture3d*, bool dsa = true) const noexcept;
28  
29                 virtual std::shared_ptr<identifier> createVBO(MeshBuffer *o, VBO_BUFFER_TYPE t, VBO_BUFFER_ALIGNMENT a = VBO_STATIC, bool dsa = true) const noexcept;
30                 virtual std::shared_ptr<shader>     createShader(bool dsa = true) const noexcept;
31  
32                 virtual void setViewport(const math::vector2di& i) noexcept;
33                 virtual void setAntialiasing(const AntiailiasingMode &i) noexcept;
34  
35                 virtual AntiailiasingMode getAntiailiasing() const noexcept;
36                 virtual math::vector2di getViewport() const noexcept;
37  
38                 bool testError(int line, const std::string &file) const noexcept;
39  
40                 virtual bool bind() noexcept;
41                 virtual void begin(const math::pixel &clearcolor = math::pixel(0xFFAAFFFF)) noexcept;
42                 virtual void end() noexcept;
43             protected:
44                 math::vector2di viewport;
45                 AntiailiasingMode aam;
46  
47                 #if defined __linux
48                     GLXContext cx;
49                 #elif defined WIN32 || WIN64
50                     HGLRC cx;
51                 #endif
52  
53                 bool checkExtension(const char *name) noexcept;
54                 bool testError() const noexcept;
55             private:
56                 bool dsa, txarray, tx3d;
57         };
58     }
59 }
60  
61 #endif