source: trunk/nv/gl/gl_context.hh @ 245

Last change on this file since 245 was 245, checked in by epyon, 11 years ago
  • gl library wgl support
  • gl context and window adoption
File size: 2.1 KB
Line 
1// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
2// http://chaosforge.org/
3//
4// This file is part of NV Libraries.
5// For conditions of distribution and use, see copyright notice in nv.hh
6/**
7 * @file gl_context.hh
8 * @author Kornel Kisielewicz epyon@chaosforge.org
9 * @brief Context class
10 */
11
12#ifndef NV_GL_CONTEXT_HH
13#define NV_GL_CONTEXT_HH
14
15#include <nv/interface/context.hh>
16
17namespace nv
18{
19        class gl_context : public context
20        {
21        protected:
22                gl_context( device* a_device );
23        public:
24                ~gl_context();
25                virtual void clear( const clear_state& cs );
26                // temporary
27                virtual void draw( primitive prim, const render_state& rs, program* p, vertex_array* va, size_t count );
28                virtual const ivec4& get_viewport();
29                virtual void set_viewport( const ivec4& viewport );
30                virtual void apply_render_state( const render_state& state );
31        protected:
32                void force_apply_render_state( const render_state& state );
33                void force_apply_stencil_face( unsigned face, const stencil_test_face& stencil );
34        private:
35                void apply_stencil_test( const stencil_test& stencil );
36                void apply_stencil_face( unsigned face, stencil_test_face& stencil, const stencil_test_face& new_stencil );
37                void apply_scissor_test( const scissor_test& scissor );
38                void apply_depth_test( const depth_test& depth );
39                void apply_depth_mask( bool mask );
40                void apply_depth_range( const depth_range& range );
41                void apply_color_mask( const color_mask& mask );
42                void apply_blending( const blending& blend );
43                void apply_culling( const culling& cull );
44                void apply_polygon_mode( const polygon_mode& mode );
45                void enable( unsigned int what, bool value );
46
47        private:
48                vec4  m_clear_color;
49                float m_clear_depth;
50                int   m_clear_stencil;
51        };
52
53        class sdl_gl_context : public gl_context
54        {
55        public:
56                sdl_gl_context( device* a_device, void* a_sdl_win_handle );
57                ~sdl_gl_context();
58        private:
59                void* m_handle;
60        };
61
62        class native_gl_context : public gl_context
63        {
64        public:
65                native_gl_context( device* a_device, void* a_native_win_handle );
66                ~native_gl_context();
67        private:
68                void* m_handle;
69        };
70
71
72} // namespace nv
73
74#endif // NV_CONTEXT_HH
Note: See TracBrowser for help on using the repository browser.