[−][src]Trait opencv::core::Texture2DTrait
Smart pointer for OpenGL 2D texture memory with reference counting.
Required methods
fn as_raw_Texture2D(&self) -> *const c_void
fn as_raw_mut_Texture2D(&mut self) -> *mut c_void
Provided methods
fn create(
&mut self,
arows: i32,
acols: i32,
aformat: Texture2D_Format,
auto_release: bool
) -> Result<()>
&mut self,
arows: i32,
acols: i32,
aformat: Texture2D_Format,
auto_release: bool
) -> Result<()>
Allocates memory for ogl::Texture2D object.
Parameters
- arows: Number of rows.
- acols: Number of columns.
- aformat: Image format. See cv::ogl::Texture2D::Format .
- autoRelease: Auto release mode (if true, release will be called in object's destructor).
C++ default parameters
- auto_release: false
fn create_1(
&mut self,
asize: Size,
aformat: Texture2D_Format,
auto_release: bool
) -> Result<()>
&mut self,
asize: Size,
aformat: Texture2D_Format,
auto_release: bool
) -> Result<()>
Allocates memory for ogl::Texture2D object.
Parameters
- arows: Number of rows.
- acols: Number of columns.
- aformat: Image format. See cv::ogl::Texture2D::Format .
- autoRelease: Auto release mode (if true, release will be called in object's destructor).
Overloaded parameters
- asize: 2D array size.
- aformat: Image format. See cv::ogl::Texture2D::Format .
- autoRelease: Auto release mode (if true, release will be called in object's destructor).
C++ default parameters
- auto_release: false
fn release(&mut self) -> Result<()>
Decrements the reference counter and destroys the texture object if needed.
The function will call setAutoRelease(true) .
fn set_auto_release(&mut self, flag: bool) -> Result<()>
Sets auto release mode.
Parameters
- flag: Auto release mode (if true, release will be called in object's destructor).
The lifetime of the OpenGL object is tied to the lifetime of the context. If OpenGL context was bound to a window it could be released at any time (user can close a window). If object's destructor is called after destruction of the context it will cause an error. Thus ogl::Texture2D doesn't destroy OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL context). This function can force ogl::Texture2D destructor to destroy OpenGL object.
fn copy_from(
&mut self,
arr: &dyn ToInputArray,
auto_release: bool
) -> Result<()>
&mut self,
arr: &dyn ToInputArray,
auto_release: bool
) -> Result<()>
Copies from host/device memory to OpenGL texture.
Parameters
- arr: Input array (host or device memory, it can be Mat , cuda::GpuMat or ogl::Buffer ).
- autoRelease: Auto release mode (if true, release will be called in object's destructor).
C++ default parameters
- auto_release: false
fn copy_to(
&self,
arr: &mut dyn ToOutputArray,
ddepth: i32,
auto_release: bool
) -> Result<()>
&self,
arr: &mut dyn ToOutputArray,
ddepth: i32,
auto_release: bool
) -> Result<()>
Copies from OpenGL texture to host/device memory or another OpenGL texture object.
Parameters
- arr: Destination array (host or device memory, can be Mat , cuda::GpuMat , ogl::Buffer or ogl::Texture2D ).
- ddepth: Destination depth.
- autoRelease: Auto release mode for destination buffer (if arr is OpenGL buffer or texture).
C++ default parameters
- ddepth: CV_32F
- auto_release: false
fn bind(&self) -> Result<()>
Binds texture to current active texture unit for GL_TEXTURE_2D target.
fn rows(&self) -> Result<i32>
fn cols(&self) -> Result<i32>
fn size(&self) -> Result<Size>
fn empty(&self) -> Result<bool>
fn format(&self) -> Result<Texture2D_Format>
fn tex_id(&self) -> Result<u32>
get OpenGL opject id