Changeset 233


Ignore:
Timestamp:
05/12/14 16:49:24 (11 years ago)
Author:
epyon
Message:
  • polygon_mode added to context and gl context implementation
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/gl/gl_context.hh

    r171 r233  
    4040                void apply_blending( const blending& blend );
    4141                void apply_culling( const culling& cull );
     42                void apply_polygon_mode( const polygon_mode& mode );
    4243                void enable( unsigned int what, bool value );
    4344
  • trunk/nv/gl/gl_enum.hh

    r214 r233  
    2525        unsigned int clear_state_buffers_to_mask( clear_state::buffers_type type );
    2626        unsigned int depth_state_function_to_enum( depth_test::function_type type );
     27        unsigned int polygon_mode_fill_to_enum( polygon_mode::fill_type type );
    2728        unsigned int blending_factor_to_enum( blending::factor type );
    2829        unsigned int blending_equation_to_enum( blending::equation type );
  • trunk/nv/interface/render_state.hh

    r214 r233  
    3939
    4040                depth_test() : enabled( true ), function( LESS ) {}
     41        };
     42
     43        struct polygon_mode
     44        {
     45                enum fill_type
     46                {
     47                        POINT,
     48                        LINE,
     49                        FILL
     50                };
     51
     52                fill_type fill;
     53
     54                polygon_mode() : fill( FILL ) {}
    4155        };
    4256
     
    183197                nv::culling      culling;
    184198                nv::color_mask   color_mask;
     199                nv::polygon_mode polygon_mode;
    185200                bool depth_mask;
    186201        };
  • trunk/src/gl/gl_context.cc

    r198 r233  
    171171}
    172172
     173void gl_context::apply_polygon_mode( const polygon_mode& mode )
     174{
     175        if ( m_render_state.polygon_mode.fill != mode.fill )
     176        {
     177                glPolygonMode( GL_FRONT_AND_BACK, polygon_mode_fill_to_enum( mode.fill ) );
     178                m_render_state.polygon_mode.fill = mode.fill;
     179        }
     180}
     181
     182
    173183void gl_context::apply_depth_range( const depth_range& range )
    174184{
     
    316326                state.color_mask.blue, state.color_mask.alpha
    317327        );
     328        glPolygonMode( GL_FRONT_AND_BACK, polygon_mode_fill_to_enum( state.polygon_mode.fill ) );
    318329}
    319330
     
    347358        apply_color_mask( state.color_mask );
    348359        apply_depth_mask( state.depth_mask );
     360        apply_polygon_mode( state.polygon_mode );
    349361}
    350362
  • trunk/src/gl/gl_enum.cc

    r121 r233  
    3333        }
    3434}
     35
     36unsigned int nv::polygon_mode_fill_to_enum( polygon_mode::fill_type type )
     37{
     38        switch( type )
     39        {
     40        case polygon_mode::FILL           : return GL_FILL;
     41        case polygon_mode::LINE           : return GL_LINE;
     42        case polygon_mode::POINT          : return GL_POINT;
     43        NV_RETURN_COVERED_DEFAULT( 0 );
     44        }
     45}
     46
     47
    3548
    3649unsigned int nv::blending_factor_to_enum( blending::factor type )
Note: See TracChangeset for help on using the changeset viewer.