Exemple #1
0
sge::d3d9::vertex::d3d_buffer_unique_ptr
sge::d3d9::devicefuncs::create_vertex_buffer(
	IDirect3DDevice9 &_device,
	sge::renderer::size_type const _size,
	D3DPOOL const _pool,
	sge::d3d9::usage const _usage
)
{
	IDirect3DVertexBuffer9 *ret;

	if(
		_device.CreateVertexBuffer(
			fcppt::cast::size<
				UINT
			>(
				_size
				
			),
			_usage.get(),
			0, // no FVF
			_pool,
			&ret,
			nullptr
		)
		!= D3D_OK
	)
		throw 
			sge::renderer::exception{
				FCPPT_TEXT("Cannot create vertex buffer!")
			};

	return
		sge::d3d9::vertex::d3d_buffer_unique_ptr(
			ret
		);
}
Exemple #2
0
sge::d3d9::texture::d3d_texture_unique_ptr
sge::d3d9::devicefuncs::create_texture(
	IDirect3DDevice9 &_device,
	sge::renderer::texture::planar_parameters const &_params,
	D3DFORMAT const _color_format,
	D3DPOOL const _pool,
	sge::d3d9::usage const _usage
)
{
	IDirect3DTexture9 *ret(
		nullptr
	);

	if(
		_device.CreateTexture(
			static_cast<
				UINT
			>(
				_params.size().w()
			),
			static_cast<
				UINT
			>(
				_params.size().h()
			),
			sge::d3d9::texture::mipmap::level_count(
				_params.mipmap()
			),
			_usage.get()
			|
			sge::d3d9::texture::mipmap::usage(
				_params.mipmap()
			).get(),
			_color_format,
			_pool,
			&ret,
			0
		)
		!= D3D_OK
	)
		throw sge::renderer::exception(
			FCPPT_TEXT("CreateTexture() with size ")
			+
			fcppt::insert_to_fcppt_string(
				_params.size()
			)
			+
			FCPPT_TEXT(" and color format ")
			+
			sge::image::color::format_to_string(
				_params.format().format()
			)
			+
			FCPPT_TEXT(" failed!")
		);

	return
		sge::d3d9::texture::d3d_texture_unique_ptr(
			ret
		);
}