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

Last change on this file since 302 was 302, checked in by epyon, 11 years ago
  • buffers and vertex_arrays are now handle based
File size: 2.6 KB
RevLine 
[37]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        {
[245]21        protected:
22                gl_context( device* a_device );
[37]23        public:
[171]24                ~gl_context();
[301]25                virtual void bind( texture t, texture_slot slot );
[299]26                virtual void bind( program* p );
[302]27                virtual void bind( buffer b );
28                virtual void bind( vertex_array va );
[299]29                virtual void unbind( program* p );
[302]30                virtual void unbind( buffer b );
31                virtual void unbind( vertex_array va );
[299]32
[301]33                virtual void update( texture t, void* data );
[302]34                virtual void update( buffer b, const void* data, size_t offset, size_t size );
[299]35
[44]36                virtual void clear( const clear_state& cs );
[45]37                // temporary
[302]38                virtual void draw( primitive prim, const render_state& rs, program* p, vertex_array va, size_t count );
[44]39                virtual const ivec4& get_viewport();
40                virtual void set_viewport( const ivec4& viewport );
41                virtual void apply_render_state( const render_state& state );
[245]42        protected:
[37]43                void force_apply_render_state( const render_state& state );
[121]44                void force_apply_stencil_face( unsigned face, const stencil_test_face& stencil );
[245]45        private:
[37]46                void apply_stencil_test( const stencil_test& stencil );
[121]47                void apply_stencil_face( unsigned face, stencil_test_face& stencil, const stencil_test_face& new_stencil );
[37]48                void apply_scissor_test( const scissor_test& scissor );
49                void apply_depth_test( const depth_test& depth );
50                void apply_depth_mask( bool mask );
51                void apply_depth_range( const depth_range& range );
52                void apply_color_mask( const color_mask& mask );
53                void apply_blending( const blending& blend );
54                void apply_culling( const culling& cull );
[233]55                void apply_polygon_mode( const polygon_mode& mode );
[37]56                void enable( unsigned int what, bool value );
57
58        private:
59                vec4  m_clear_color;
60                float m_clear_depth;
61                int   m_clear_stencil;
[245]62        };
63
64        class sdl_gl_context : public gl_context
65        {
66        public:
67                sdl_gl_context( device* a_device, void* a_sdl_win_handle );
68                ~sdl_gl_context();
69        private:
[171]70                void* m_handle;
[37]71        };
72
[245]73        class native_gl_context : public gl_context
74        {
75        public:
76                native_gl_context( device* a_device, void* a_native_win_handle );
[295]77                void* get_native_handle() { return m_handle; }
[245]78                ~native_gl_context();
79        private:
80                void* m_handle;
81        };
82
83
[37]84} // namespace nv
85
86#endif // NV_CONTEXT_HH
Note: See TracBrowser for help on using the repository browser.