![]() |
OpenCV
4.0.0
Open Source Computer Vision
|
Smart pointer for OpenGL 2D texture memory with reference counting. More...
#include "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. More... | |
Texture2D (int arows, int acols, Format aformat, unsigned int atexId, bool autoRelease=false) | |
Texture2D (Size asize, Format aformat, unsigned int atexId, bool autoRelease=false) | |
Texture2D (int arows, int acols, Format aformat, bool autoRelease=false) | |
Texture2D (Size asize, Format aformat, bool autoRelease=false) | |
Texture2D (InputArray arr, bool autoRelease=false) | |
void | bind () const |
Binds texture to current active texture unit for GL_TEXTURE_2D target. More... | |
int | cols () const |
void | copyFrom (InputArray arr, bool autoRelease=false) |
Copies from host/device memory to OpenGL texture. More... | |
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. More... | |
void | create (int arows, int acols, Format aformat, bool autoRelease=false) |
Allocates memory for ogl::Texture2D object. More... | |
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. More... | |
int | rows () const |
void | setAutoRelease (bool flag) |
Sets auto release mode. More... | |
Size | size () const |
unsigned int | texId () const |
get OpenGL opject id More... | |
Smart pointer for OpenGL 2D texture memory with reference counting.
cv::ogl::Texture2D::Texture2D | ( | ) |
The constructors.
Creates empty ogl::Texture2D object, allocates memory for ogl::Texture2D object or copies from host/device memory.
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.
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.
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.
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). |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
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). |
|
explicit |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
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). |
void cv::ogl::Texture2D::bind | ( | ) | const |
Binds texture to current active texture unit for GL_TEXTURE_2D target.
int cv::ogl::Texture2D::cols | ( | ) | const |
void cv::ogl::Texture2D::copyFrom | ( | InputArray | arr, |
bool | autoRelease = false |
||
) |
Copies from host/device memory to OpenGL texture.
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). |
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.
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). |
void cv::ogl::Texture2D::create | ( | int | arows, |
int | acols, | ||
Format | aformat, | ||
bool | autoRelease = false |
||
) |
Allocates memory for ogl::Texture2D object.
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). |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
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). |
bool cv::ogl::Texture2D::empty | ( | ) | const |
Format cv::ogl::Texture2D::format | ( | ) | const |
void cv::ogl::Texture2D::release | ( | ) |
Decrements the reference counter and destroys the texture object if needed.
The function will call setAutoRelease(true) .
int cv::ogl::Texture2D::rows | ( | ) | const |
void cv::ogl::Texture2D::setAutoRelease | ( | bool | flag | ) |
Sets auto release mode.
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 cv::ogl::Texture2D::size | ( | ) | const |
unsigned int cv::ogl::Texture2D::texId | ( | ) | const |
get OpenGL opject id