Ejemplo n.º 1
0
sge::opengl::vf::client_state_combiner::client_state_combiner(
	fcppt::log::object &_log,
	sge::opengl::context::object &_context
)
:
	log_{
		_log
	},
	context_(
		_context
	),
	vf_context_(
		sge::opengl::context::use<
			sge::opengl::vf::context
		>(
			_context,
			_log
		)
	),
	attribute_context_(
		sge::opengl::context::use<
			sge::opengl::vf::attribute_context
		>(
			_context,
			_context.info()
		)
	),
	old_states_(
		vf_context_.state()
	),
	new_states_(
		old_states_
	)
{
}
Ejemplo n.º 2
0
sge::opengl::state::core::sampler::actor_vector
sge::opengl::state::core::sampler::filter::anisotropic(
	sge::opengl::context::object &_context,
	sge::renderer::state::core::sampler::filter::anisotropic::parameters const &_filter
)
{
	return
		sge::opengl::state::core::sampler::actor_vector{
			sge::opengl::state::core::sampler::actor{
				std::bind(
					sge::opengl::texture::funcs::parameter_int,
					std::placeholders::_1,
					GL_TEXTURE_MAG_FILTER,
					GL_NEAREST
				)
			},
			sge::opengl::state::core::sampler::actor{
				std::bind(
					sge::opengl::texture::funcs::parameter_int,
					std::placeholders::_1,
					GL_TEXTURE_MIN_FILTER,
					fcppt::cast::to_signed(
						sge::opengl::state::convert::anisotropic_mip_filter(
							_filter.mip()
						)
					)
				)
			},
			sge::opengl::state::core::sampler::actor{
				std::bind(
					sge::opengl::texture::funcs::parameter_int,
					std::placeholders::_1,
					fcppt::optional::to_exception(
						sge::opengl::context::use<
							sge::opengl::state::core::sampler::filter::anisotropy_context
						>(
							_context,
							_context.info()
						).config(),
						[]{
							return
								sge::renderer::unsupported{
									FCPPT_TEXT("anisotropic filtering"),
									FCPPT_TEXT(""),
									FCPPT_TEXT("GL_EXT_texture_filter_anisotropic")
								};
						}
					).anisotropy_flag(),
					fcppt::cast::to_signed(
						_filter.level().get()
					)
				)
			}
		};
}
Ejemplo n.º 3
0
sge::opengl::state::actor
sge::opengl::state::core::blend::alpha_enabled(
	sge::opengl::context::object &_context,
	sge::renderer::state::core::blend::alpha_enabled const &_variant
)
{
	return
		fcppt::variant::match(
			_variant,
			[](
				sge::renderer::state::core::blend::combined const &_combined
			)
			{
				return
					sge::opengl::state::wrap_error_handler<
						sge::opengl::state::actor
					>(
						std::bind(
							sge::opengl::get_fun_ref(
								::glBlendFunc
							),
							sge::opengl::state::convert::source_blend_func(
								_combined.source()
							),
							sge::opengl::state::convert::dest_blend_func(
								_combined.dest()
							)
						),
						FCPPT_TEXT("glBlendFunc")
					);
			},
			[
				&_context
			](
				sge::renderer::state::core::blend::separate const &_separate
			)
			{
				return
					sge::opengl::state::wrap_error_handler<
						sge::opengl::state::actor
					>(
						std::bind(
							fcppt::optional::to_exception(
								sge::opengl::context::use<
									sge::opengl::state::core::blend::context
								>(
									_context,
									_context.info()
								).config(),
								[]{
									return
										sge::renderer::unsupported{
											FCPPT_TEXT("blend func separate"),
											FCPPT_TEXT("1.4"),
											FCPPT_TEXT("")
										};
								}
							).blend_func_separate(),
							sge::opengl::state::convert::source_blend_func(
								_separate.color_source().get()
							),
							sge::opengl::state::convert::dest_blend_func(
								_separate.color_dest().get()
							),
							sge::opengl::state::convert::source_blend_func(
								_separate.alpha_source().get()
							),
							sge::opengl::state::convert::dest_blend_func(
								_separate.alpha_dest().get()
							)
						),
						FCPPT_TEXT("glBlendFuncSeparate")
					);
			}
		);
}