void sge::opengl::texture::funcs::get_image( sge::opengl::texture::binding const &, sge::opengl::texture::buffer_type const _buffer_type, sge::opengl::color_order const _format, sge::opengl::color_base_type const _format_type, sge::renderer::raw_pointer const _dest, sge::renderer::texture::mipmap::level const _level ) { sge::opengl::call( ::glGetTexImage, _buffer_type.get(), fcppt::cast::to_signed( _level.get() ), _format.get(), _format_type.get(), fcppt::cast::to_void_ptr( _dest ) ); SGE_OPENGL_CHECK_STATE( FCPPT_TEXT("glGetTexImage failed"), sge::renderer::exception ) }
GLint sge::opengl::texture::funcs::level_parameter( sge::opengl::texture::binding const &, sge::opengl::texture::buffer_type const _type, sge::renderer::texture::mipmap::level const _level, GLenum const _what ) { GLint ret; sge::opengl::call( ::glGetTexLevelParameteriv, _type.get(), fcppt::cast::to_signed( _level.get() ), _what, &ret ); SGE_OPENGL_CHECK_STATE( FCPPT_TEXT("glGetTexLevelParameteriv() failed!"), sge::renderer::exception ); return ret; }
void sge::opengl::texture::funcs::set_rect( sge::opengl::texture::binding const &, sge::opengl::context::object &_context, sge::opengl::texture::surface_config const &, sge::opengl::texture::buffer_type const _buffer_type, sge::opengl::color_order const _format, sge::opengl::color_base_type const _format_type, sge::renderer::texture::mipmap::level const _level, sge::renderer::dim2 const &_dim, sge::renderer::lock_rect const &_lock_rect, sge::renderer::const_raw_pointer const _src ) { if( _src == nullptr && !sge::opengl::context::use< sge::opengl::buffer::pbo_context >( _context, _context ) .unpack_buffer() .native() ) throw sge::renderer::exception{ FCPPT_TEXT("OpenGL: Texture source is 0 although no PBO is bound!") }; if( !sge::opengl::range_check( _dim, _lock_rect ) ) throw sge::renderer::exception{ ( fcppt::format( FCPPT_TEXT("rect for setting a texture is out of range (rect=%1%, dim=%2%)!") ) % _lock_rect % _dim ) .str() }; sge::renderer::lock_rect::dim const lock_size( _lock_rect.size() ); ::glTexSubImage2D( _buffer_type.get(), fcppt::cast::to_signed( _level.get() ), fcppt::cast::size< GLint >( fcppt::cast::to_signed( _lock_rect.left() ) ), fcppt::cast::size< GLint >( fcppt::cast::to_signed( _lock_rect.top() ) ), fcppt::cast::size< GLsizei >( fcppt::cast::to_signed( lock_size.w() ) ), fcppt::cast::size< GLsizei >( fcppt::cast::to_signed( lock_size.h() ) ), _format.get(), _format_type.get(), _src ); SGE_OPENGL_CHECK_STATE( ( fcppt::format( FCPPT_TEXT("glTexSubImage2D with rect (rect=%1%, dim=%2%) failed") ) % _lock_rect % _dim ).str(), sge::renderer::exception ) }