Beispiel #1
0
/**
 * \brief Sets the shader program to apply for the next render commands.
 * \param p The program to apply.
 */
void bear::visual::gl_screen::push_shader( const shader_program& p )
{
  m_shader.push_back( p );

  if ( p.is_valid() )
    use_program( p );
} // gl_screen::push_shader()
Beispiel #2
0
void bear::visual::detail::apply_shader( const shader_program& shader )
{
  assert ( shader.is_valid() );

  const gl_shader_program* const s
    ( static_cast<const gl_shader_program*>( shader.get_impl() ) );

  assert( s->program_id() != 0 );
  
  glUseProgram( s->program_id() );
  VISUAL_GL_ERROR_THROW();

  shader_program::variable_visitor_type visitor;
  shader_program::input_variable_map vars( shader.get_variables() );
  visitor.run( vars, uniform_setter( s->program_id() ) );
}