Class cv::ogl::Texture2D#
Smart pointer for OpenGL 2D texture memory with reference counting.
#include <opencv2/core/opengl.hpp>Collaboration diagram for cv::ogl::Texture2D:
Public Types#
An Image Format describes the way that the images in Textures store their data.
enum Format {
NONE = 0,
DEPTH_COMPONENT = 0x1902,
RGB = 0x1907,
RGBA = 0x1908
}Detailed Description#
Smart pointer for OpenGL 2D texture memory with reference counting.
Member Enumeration Documentation#
enum Format
An Image Format describes the way that the images in Textures store their data.
|
|
|
Depth. |
|
Red, Green, Blue. |
|
Red, Green, Blue, Alpha. |
Constructor & Destructor Documentation#
Texture2D()#
cv::ogl::Texture2D::Texture2D()
The constructors.
Creates empty ogl::Texture2D object, allocates memory for ogl::Texture2D object or copies from host/device memory.
Texture2D()#
cv::ogl::Texture2D::Texture2D(
InputArray arr,
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
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).
Texture2D()#
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()#
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()#
cv::ogl::Texture2D::Texture2D(
Size asize,
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
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()#
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.
Member Function Documentation#
bind()#
void cv::ogl::Texture2D::bind()
Binds texture to current active texture unit for GL_TEXTURE_2D target.
cols()#
int cv::ogl::Texture2D::cols()
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 )
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()#
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()#
void cv::ogl::Texture2D::create(
Size asize,
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
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()
format()#
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()
setAutoRelease()#
void cv::ogl::Texture2D::setAutoRelease(bool flag)
Sets auto release mode.
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.
Parameters
flag— Auto release mode (if true, release will be called in object’s destructor).
size()#
texId()#
unsigned int cv::ogl::Texture2D::texId()
get OpenGL opject id
Member Data Documentation#
cols_#
int cv::ogl::Texture2D::cols_
format_#
impl_#
rows_#
int cv::ogl::Texture2D::rows_
Source file#
The documentation for this class was generated from the following file:
opencv2/core/opengl.hpp