Esempio n. 1
0
void
sge::d3d9::cg::texture::set(
    IDirect3DDevice9 &_device,
    sge::cg::parameter::object const &_parameter,
    IDirect3DBaseTexture9 *const _texture
)
{
    sge::d3d9::cg::scoped_device const context(
        _device
    );

    if(
        ::cgD3D9SetTexture(
            _parameter.get(),
            _texture
        )
        !=
        D3D_OK
    )
        throw sge::renderer::exception(
            FCPPT_TEXT("cgD3D9SetTexture failed")
        );

    SGE_CG_CHECK_STATE(
        FCPPT_TEXT("cgD3D9SetTexture failed"),
        sge::renderer::exception
    )
}
Esempio n. 2
0
void
sge::opengl::cg::texture::enable_parameter(
	sge::cg::parameter::object const &_parameter
)
{
	::cgGLEnableTextureParameter(
		_parameter.get()
	);

	SGE_CG_CHECK_STATE(
		FCPPT_TEXT("cgEnableTextureParameter failed"),
		sge::renderer::exception
	)
}
Esempio n. 3
0
sge::renderer::texture::stage
sge::opengl::cg::texture::assigned_stage(
	sge::cg::parameter::object const &_parameter
)
{
	GLenum const ret(
		::cgGLGetTextureEnum(
			_parameter.get()
		)
	);

	if(
		ret
		==
		GL_INVALID_OPERATION
	)
		throw sge::renderer::exception(
			FCPPT_TEXT("cgGLGetTextureEnum failed")
		);

	SGE_CG_CHECK_STATE(
		FCPPT_TEXT("cgGLGetTextureEnum failed"),
		sge::renderer::exception
	);

	FCPPT_ASSERT_ERROR(
		ret >= GL_TEXTURE0_ARB
	);

	return
		fcppt::strong_typedef_construct_cast<
			sge::renderer::texture::stage,
			fcppt::cast::static_cast_fun
		>(
			ret
			-
			GL_TEXTURE0_ARB
		);
}