OpenCV 4.13.0
开源计算机视觉库 (Open Source Computer Vision)
正在加载...
正在搜索...
未找到匹配项
cv::ogl::Texture2D 类参考

带引用计数的 OpenGL 2D 纹理内存的智能指针。更多...

#include <opencv2/core/opengl.hpp>

cv::ogl::Texture2D 的协作图

公开类型

enum  Format {
  NONE = 0 ,
  DEPTH_COMPONENT = 0x1902 ,
  RGB = 0x1907 ,
  RGBA = 0x1908
}
 图像格式描述了纹理中图像存储数据的方式。更多...
 

公开成员函数

 Texture2D ()
 构造函数。
 
 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
 将纹理绑定到当前激活的纹理单元以用于 GL_TEXTURE_2D 目标。
 
int cols () const
 
void copyFrom (InputArray arr, bool autoRelease=false)
 将数据从主机/设备内存复制到 OpenGL 纹理。
 
void copyTo (OutputArray arr, int ddepth=CV_32F, bool autoRelease=false) const
 将数据从 OpenGL 纹理复制到主机/设备内存或其他 OpenGL 纹理对象。
 
void create (int arows, int acols, Format aformat, bool autoRelease=false)
 ogl::Texture2D 对象分配内存。
 
void create (Size asize, Format aformat, bool autoRelease=false)
 
bool empty () const
 
Format format () const
 
void release (释放) ()
 递减引用计数器,并在需要时销毁纹理对象。
 
int rows () const
 
void setAutoRelease (bool flag)
 设置自动释放模式。
 
Size size () const
 
unsigned int texId () const
 获取 OpenGL 对象 ID
 

详细说明

带引用计数的 OpenGL 2D 纹理内存的智能指针。

成员枚举文档

◆ Format

图像格式描述了纹理中图像存储数据的方式。

枚举值 (Enumerator)
NONE 
DEPTH_COMPONENT 

深度。

RGB 

红、绿、蓝。

RGBA 

红、绿、蓝、Alpha。

构造函数与析构函数说明

◆ Texture2D() [1/6]

cv::ogl::Texture2D::Texture2D ( )

构造函数。

创建空的 ogl::Texture2D 对象,为 ogl::Texture2D 对象分配内存或从主机/设备内存复制。

◆ Texture2D() [2/6]

cv::ogl::Texture2D::Texture2D ( int 行数,
int 列数,
Format aformat,
unsigned int atexId,
bool autoRelease = false )

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

◆ Texture2D() [3/6]

cv::ogl::Texture2D::Texture2D ( Size 大小,
Format aformat,
unsigned int atexId,
bool autoRelease = false )

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

◆ Texture2D() [4/6]

cv::ogl::Texture2D::Texture2D ( int 行数,
int 列数,
Format aformat,
bool autoRelease = false )

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

参数
行数行数。
列数列数。
aformat图像格式。请参阅 cv::ogl::Texture2D::Format
autoRelease自动释放模式(如果为 true,将在对象析构函数中调用 release)。

◆ Texture2D() [5/6]

cv::ogl::Texture2D::Texture2D ( Size 大小,
Format aformat,
bool autoRelease = false )

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

参数
大小2D 数组大小。
aformat图像格式。请参阅 cv::ogl::Texture2D::Format
autoRelease自动释放模式(如果为 true,将在对象析构函数中调用 release)。

◆ Texture2D() [6/6]

cv::ogl::Texture2D::Texture2D ( InputArray arr (数组),
bool autoRelease = false )
explicit (显式)

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

参数
arr (数组)输入数组(主机或设备内存,可以是 Matcuda::GpuMatogl::Buffer )。
autoRelease自动释放模式(如果为 true,将在对象析构函数中调用 release)。

成员函数说明

◆ bind()

void cv::ogl::Texture2D::bind ( ) const

将纹理绑定到当前激活的纹理单元以用于 GL_TEXTURE_2D 目标。

◆ cols()

int cv::ogl::Texture2D::cols ( ) const

◆ copyFrom()

void cv::ogl::Texture2D::copyFrom ( InputArray arr (数组),
bool autoRelease = false )

将数据从主机/设备内存复制到 OpenGL 纹理。

参数
arr (数组)输入数组(主机或设备内存,可以是 Matcuda::GpuMatogl::Buffer )。
autoRelease自动释放模式(如果为 true,将在对象析构函数中调用 release)。

◆ copyTo()

void cv::ogl::Texture2D::copyTo ( OutputArray arr (数组),
int ddepth = CV_32F,
bool autoRelease = false ) const

将数据从 OpenGL 纹理复制到主机/设备内存或其他 OpenGL 纹理对象。

参数
arr (数组)目标数组(主机或设备内存,可以是 Matcuda::GpuMatogl::Bufferogl::Texture2D )。
ddepth目标深度。
autoRelease目标缓冲区的自动释放模式(如果 arr 是 OpenGL 缓冲区或纹理)。

◆ create() [1/2]

void cv::ogl::Texture2D::create ( int 行数,
int 列数,
Format aformat,
bool autoRelease = false )

ogl::Texture2D 对象分配内存。

参数
行数行数。
列数列数。
aformat图像格式。请参阅 cv::ogl::Texture2D::Format
autoRelease自动释放模式(如果为 true,将在对象析构函数中调用 release)。

◆ create() [2/2]

void cv::ogl::Texture2D::create ( Size 大小,
Format aformat,
bool autoRelease = false )

这是一个重载的成员函数,为方便起见而提供。它与上述函数的区别仅在于所接受的参数不同。

参数
大小2D 数组大小。
aformat图像格式。请参阅 cv::ogl::Texture2D::Format
autoRelease自动释放模式(如果为 true,将在对象析构函数中调用 release)。

◆ empty()

bool cv::ogl::Texture2D::empty ( ) const

◆ format()

Format cv::ogl::Texture2D::format ( ) const

◆ release()

void cv::ogl::Texture2D::release ( )

递减引用计数器,并在需要时销毁纹理对象。

该函数将调用 setAutoRelease(true)。

◆ rows()

int cv::ogl::Texture2D::rows ( ) const

◆ setAutoRelease()

void cv::ogl::Texture2D::setAutoRelease ( bool 标志)

设置自动释放模式。

参数
标志自动释放模式(如果为 true,将在对象析构函数中调用 release)。

OpenGL 对象的生命周期与其上下文相关联。如果 OpenGL 上下文绑定到一个窗口,则可以随时释放它(用户可以关闭窗口)。如果对象的析构函数在上下文销毁后调用,它将导致错误。因此,ogl::Texture2D 默认不在其析构函数中销毁 OpenGL 对象(所有 OpenGL 资源将随 OpenGL 上下文一起释放)。此函数可以强制 ogl::Texture2D 析构函数销毁 OpenGL 对象。

◆ size()

Size cv::ogl::Texture2D::size ( ) const

◆ texId()

unsigned int cv::ogl::Texture2D::texId ( ) const

获取 OpenGL 对象 ID


该类的文档由以下文件生成: