Smart pointer for OpenGL 2D texture memory with reference counting. More...
#include <opencv2/core/opengl.hpp>
Public Types | |
enum | Format { NONE = 0 , DEPTH_COMPONENT = 0x1902 , RGB = 0x1907 , RGBA = 0x1908 } |
An Image Format describes the way that the images in Textures store their data. More... | |
Public Member Functions | |
Texture2D () | |
The constructors. | |
Texture2D (InputArray arr, bool autoRelease=false) | |
Texture2D (int arows, int acols, Format aformat, bool autoRelease=false) | |
Texture2D (int arows, int acols, Format aformat, unsigned int atexId, bool autoRelease=false) | |
Texture2D (Size asize, Format aformat, bool autoRelease=false) | |
Texture2D (Size asize, Format aformat, unsigned int atexId, bool autoRelease=false) | |
void | bind () const |
Binds texture to current active texture unit for GL_TEXTURE_2D target. | |
int | cols () const |
void | copyFrom (InputArray arr, bool autoRelease=false) |
Copies from host/device memory to OpenGL texture. | |
void | copyTo (OutputArray arr, int ddepth=CV_32F, bool autoRelease=false) const |
Copies from OpenGL texture to host/device memory or another OpenGL texture object. | |
void | create (int arows, int acols, Format aformat, bool autoRelease=false) |
Allocates memory for ogl::Texture2D object. | |
void | create (Size asize, Format aformat, bool autoRelease=false) |
bool | empty () const |
Format | format () const |
void | release () |
Decrements the reference counter and destroys the texture object if needed. | |
int | rows () const |
void | setAutoRelease (bool flag) |
Sets auto release mode. | |
Size | size () const |
unsigned int | texId () const |
get OpenGL opject id | |
Detailed Description
Smart pointer for OpenGL 2D texture memory with reference counting.
Member Enumeration Documentation
◆ Format
Constructor & Destructor Documentation
◆ Texture2D() [1/6]
cv::ogl::Texture2D::Texture2D | ( | ) |
The constructors.
Creates empty ogl::Texture2D object, allocates memory for ogl::Texture2D object or copies from host/device memory.
◆ Texture2D() [2/6]
cv::ogl::Texture2D::Texture2D | ( | int | arows, |
int | acols, | ||
Format | aformat, | ||
unsigned int | atexId, | ||
bool | autoRelease = false |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ Texture2D() [3/6]
cv::ogl::Texture2D::Texture2D | ( | Size | asize, |
Format | aformat, | ||
unsigned int | atexId, | ||
bool | autoRelease = false |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
◆ Texture2D() [4/6]
cv::ogl::Texture2D::Texture2D | ( | int | arows, |
int | acols, | ||
Format | aformat, | ||
bool | autoRelease = false |
||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- 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).
◆ Texture2D() [5/6]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- 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).
◆ Texture2D() [6/6]
|
explicit |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- 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).
Member Function Documentation
◆ bind()
void cv::ogl::Texture2D::bind | ( | ) | const |
Binds texture to current active texture unit for GL_TEXTURE_2D target.
◆ cols()
int cv::ogl::Texture2D::cols | ( | ) | const |
◆ copyFrom()
void cv::ogl::Texture2D::copyFrom | ( | InputArray | arr, |
bool | autoRelease = false |
||
) |
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).
◆ copyTo()
void cv::ogl::Texture2D::copyTo | ( | OutputArray | arr, |
int | ddepth = CV_32F , |
||
bool | autoRelease = false |
||
) | const |
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).
◆ create() [1/2]
void cv::ogl::Texture2D::create | ( | int | arows, |
int | acols, | ||
Format | aformat, | ||
bool | autoRelease = false |
||
) |
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).
◆ create() [2/2]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- 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).
◆ empty()
bool cv::ogl::Texture2D::empty | ( | ) | const |
◆ format()
Format cv::ogl::Texture2D::format | ( | ) | const |
◆ release()
void cv::ogl::Texture2D::release | ( | ) |
Decrements the reference counter and destroys the texture object if needed.
The function will call setAutoRelease(true) .
◆ rows()
int cv::ogl::Texture2D::rows | ( | ) | const |
◆ setAutoRelease()
void cv::ogl::Texture2D::setAutoRelease | ( | bool | flag | ) |
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.
◆ size()
Size cv::ogl::Texture2D::size | ( | ) | const |
◆ texId()
unsigned int cv::ogl::Texture2D::texId | ( | ) | const |
get OpenGL opject id
The documentation for this class was generated from the following file:
- opencv2/core/opengl.hpp