This section describes OpenGL interoperability. More...
Modules | |
CUDA-accelerated Computer Vision | |
Namespaces | |
cv::cuda | |
cv::ogl::ocl | |
Classes | |
class | cv::ogl::Arrays |
Wrapper for OpenGL Client-Side Vertex arrays. More... | |
class | cv::ogl::Buffer |
Smart pointer for OpenGL buffer object with reference counting. More... | |
class | cv::ogl::Texture2D |
Smart pointer for OpenGL 2D texture memory with reference counting. More... | |
Functions | |
cv::ogl::Arrays::Arrays () | |
Default constructor. More... | |
cv::ogl::Buffer::Buffer () | |
The constructors. More... | |
cv::ogl::Buffer::Buffer (int arows, int acols, int atype, unsigned int abufId, 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. More... | |
cv::ogl::Buffer::Buffer (Size asize, int atype, unsigned int abufId, 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. More... | |
cv::ogl::Buffer::Buffer (int arows, int acols, int atype, Target target=ARRAY_BUFFER, 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. More... | |
cv::ogl::Buffer::Buffer (Size asize, int atype, Target target=ARRAY_BUFFER, 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. More... | |
cv::ogl::Buffer::Buffer (InputArray arr, Target target=ARRAY_BUFFER, 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. More... | |
cv::ogl::Texture2D::Texture2D () | |
The constructors. More... | |
cv::ogl::Texture2D::Texture2D (int arows, int acols, Format aformat, unsigned int atexId, bool autoRelease=false) | |
cv::ogl::Texture2D::Texture2D (Size asize, Format aformat, unsigned int atexId, bool autoRelease=false) | |
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. More... | |
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. More... | |
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. More... | |
void | cv::ogl::Buffer::bind (Target target) const |
Binds OpenGL buffer to the specified buffer binding point. More... | |
void | cv::ogl::Texture2D::bind () const |
Binds texture to current active texture unit for GL_TEXTURE_2D target. More... | |
void | cv::ogl::Arrays::bind () const |
Binds all vertex arrays. More... | |
unsigned int | cv::ogl::Buffer::bufId () const |
get OpenGL opject id More... | |
int | cv::ogl::Buffer::channels () const |
Buffer | cv::ogl::Buffer::clone (Target target=ARRAY_BUFFER, bool autoRelease=false) const |
Creates a full copy of the buffer object and the underlying data. More... | |
int | cv::ogl::Buffer::cols () const |
int | cv::ogl::Texture2D::cols () const |
void | cv::ogl::convertFromGLTexture2D (const Texture2D &texture, OutputArray dst) |
Converts Texture2D object to OutputArray. More... | |
void | cv::ogl::convertToGLTexture2D (InputArray src, Texture2D &texture) |
Converts InputArray to Texture2D object. More... | |
void | cv::ogl::Buffer::copyFrom (InputArray arr, Target target=ARRAY_BUFFER, bool autoRelease=false) |
Copies from host/device memory to OpenGL buffer. More... | |
void | cv::ogl::Buffer::copyFrom (InputArray arr, cuda::Stream &stream, Target target=ARRAY_BUFFER, bool autoRelease=false) |
void | cv::ogl::Texture2D::copyFrom (InputArray arr, bool autoRelease=false) |
Copies from host/device memory to OpenGL texture. More... | |
void | cv::ogl::Buffer::copyTo (OutputArray arr) const |
Copies from OpenGL buffer to host/device memory or another OpenGL buffer object. More... | |
void | cv::ogl::Buffer::copyTo (OutputArray arr, cuda::Stream &stream) const |
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. More... | |
void | cv::ogl::Buffer::create (int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false) |
Allocates memory for ogl::Buffer object. More... | |
void | cv::ogl::Buffer::create (Size asize, int atype, Target target=ARRAY_BUFFER, 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. More... | |
void | cv::ogl::Texture2D::create (int arows, int acols, Format aformat, bool autoRelease=false) |
Allocates memory for ogl::Texture2D object. More... | |
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. More... | |
int | cv::ogl::Buffer::depth () const |
int | cv::ogl::Buffer::elemSize () const |
int | cv::ogl::Buffer::elemSize1 () const |
bool | cv::ogl::Buffer::empty () const |
bool | cv::ogl::Texture2D::empty () const |
bool | cv::ogl::Arrays::empty () const |
Format | cv::ogl::Texture2D::format () const |
Context & | cv::ogl::ocl::initializeContextFromGL () |
Creates OpenCL context from GL. More... | |
cuda::GpuMat | cv::ogl::Buffer::mapDevice () |
map to device memory (blocking) More... | |
cuda::GpuMat | cv::ogl::Buffer::mapDevice (cuda::Stream &stream) |
Maps OpenGL buffer to CUDA device memory. More... | |
UMat | cv::ogl::mapGLBuffer (const Buffer &buffer, int accessFlags=ACCESS_READ|ACCESS_WRITE) |
Maps Buffer object to process on CL side (convert to UMat). More... | |
Mat | cv::ogl::Buffer::mapHost (Access access) |
Maps OpenGL buffer to host memory. More... | |
void | cv::ogl::Buffer::release () |
Decrements the reference counter and destroys the buffer object if needed. More... | |
void | cv::ogl::Texture2D::release () |
Decrements the reference counter and destroys the texture object if needed. More... | |
void | cv::ogl::Arrays::release () |
Releases all inner buffers. More... | |
void | cv::ogl::render (const Texture2D &tex, Rect_< double > wndRect=Rect_< double >(0.0, 0.0, 1.0, 1.0), Rect_< double > texRect=Rect_< double >(0.0, 0.0, 1.0, 1.0)) |
Render OpenGL texture or primitives. More... | |
void | cv::ogl::render (const Arrays &arr, int mode=POINTS, Scalar color=Scalar::all(255)) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | cv::ogl::render (const Arrays &arr, InputArray indices, int mode=POINTS, Scalar color=Scalar::all(255)) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
void | cv::ogl::Arrays::resetColorArray () |
Resets vertex colors. More... | |
void | cv::ogl::Arrays::resetNormalArray () |
Resets vertex normals. More... | |
void | cv::ogl::Arrays::resetTexCoordArray () |
Resets vertex texture coordinates. More... | |
void | cv::ogl::Arrays::resetVertexArray () |
Resets vertex coordinates. More... | |
int | cv::ogl::Buffer::rows () const |
int | cv::ogl::Texture2D::rows () const |
void | cv::ogl::Buffer::setAutoRelease (bool flag) |
Sets auto release mode. More... | |
void | cv::ogl::Texture2D::setAutoRelease (bool flag) |
Sets auto release mode. More... | |
void | cv::ogl::Arrays::setAutoRelease (bool flag) |
Sets auto release mode all inner buffers. More... | |
void | cv::ogl::Arrays::setColorArray (InputArray color) |
Sets an array of vertex colors. More... | |
void | cv::cuda::setGlDevice (int device=0) |
Sets a CUDA device and initializes it for the current thread with OpenGL interoperability. More... | |
void | cv::ogl::Arrays::setNormalArray (InputArray normal) |
Sets an array of vertex normals. More... | |
void | cv::ogl::Arrays::setTexCoordArray (InputArray texCoord) |
Sets an array of vertex texture coordinates. More... | |
void | cv::ogl::Arrays::setVertexArray (InputArray vertex) |
Sets an array of vertex coordinates. More... | |
Size | cv::ogl::Buffer::size () const |
Size | cv::ogl::Texture2D::size () const |
int | cv::ogl::Arrays::size () const |
Returns the vertex count. More... | |
unsigned int | cv::ogl::Texture2D::texId () const |
get OpenGL opject id More... | |
int | cv::ogl::Buffer::type () const |
static void | cv::ogl::Buffer::unbind (Target target) |
Unbind any buffers from the specified binding point. More... | |
void | cv::ogl::Buffer::unmapDevice () |
void | cv::ogl::Buffer::unmapDevice (cuda::Stream &stream) |
Unmaps OpenGL buffer. More... | |
void | cv::ogl::unmapGLBuffer (UMat &u) |
Unmaps Buffer object (releases UMat, previously mapped from Buffer). More... | |
void | cv::ogl::Buffer::unmapHost () |
Unmaps OpenGL buffer. More... | |
This section describes OpenGL interoperability.
To enable OpenGL support, configure OpenCV using CMake with WITH_OPENGL=ON . Currently OpenGL is supported only with WIN32, GTK and Qt backends on Windows and Linux (MacOS and Android are not supported). For GTK backend gtkglext-1.0 library is required.
To use OpenGL functionality you should first create OpenGL context (window or frame buffer). You can do this with namedWindow function or with other OpenGL toolkit (GLUT, for example).
enum cv::ogl::RenderModes |
The target defines how you intend to use the buffer object.
cv::ogl::Arrays::Arrays | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Default constructor.
cv::ogl::Buffer::Buffer | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
The constructors.
Creates empty ogl::Buffer object, creates ogl::Buffer object from existed buffer ( abufId parameter), allocates memory for ogl::Buffer object or copies from host/device memory.
cv::ogl::Buffer::Buffer | ( | int | arows, |
int | acols, | ||
int | atype, | ||
unsigned int | abufId, | ||
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
cv::ogl::Buffer::Buffer | ( | Size | asize, |
int | atype, | ||
unsigned int | abufId, | ||
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
cv::ogl::Buffer::Buffer | ( | int | arows, |
int | acols, | ||
int | atype, | ||
Target | target = ARRAY_BUFFER , |
||
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
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 in a 2D array. |
acols | Number of columns in a 2D array. |
atype | Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. |
target | Buffer usage. See cv::ogl::Buffer::Target . |
autoRelease | Auto release mode (if true, release will be called in object's destructor). |
cv::ogl::Buffer::Buffer | ( | Size | asize, |
int | atype, | ||
Target | target = ARRAY_BUFFER , |
||
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
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. |
atype | Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. |
target | Buffer usage. See cv::ogl::Buffer::Target . |
autoRelease | Auto release mode (if true, release will be called in object's destructor). |
|
explicit |
#include <core/include/opencv2/core/opengl.hpp>
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 std::vector ). |
target | Buffer usage. See cv::ogl::Buffer::Target . |
autoRelease | Auto release mode (if true, release will be called in object's destructor). |
cv::ogl::Texture2D::Texture2D | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
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 |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
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 |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
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 |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
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). |
#include <core/include/opencv2/core/opengl.hpp>
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 |
#include <core/include/opencv2/core/opengl.hpp>
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::Buffer::bind | ( | Target | target | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
Binds OpenGL buffer to the specified buffer binding point.
target | Binding point. See cv::ogl::Buffer::Target . |
void cv::ogl::Texture2D::bind | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
Binds texture to current active texture unit for GL_TEXTURE_2D target.
void cv::ogl::Arrays::bind | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
Binds all vertex arrays.
unsigned int cv::ogl::Buffer::bufId | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
get OpenGL opject id
int cv::ogl::Buffer::channels | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
Buffer cv::ogl::Buffer::clone | ( | Target | target = ARRAY_BUFFER , |
bool | autoRelease = false |
||
) | const |
#include <core/include/opencv2/core/opengl.hpp>
Creates a full copy of the buffer object and the underlying data.
target | Buffer usage for destination buffer. |
autoRelease | Auto release mode for destination buffer. |
int cv::ogl::Buffer::cols | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
int cv::ogl::Texture2D::cols | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
void cv::ogl::convertFromGLTexture2D | ( | const Texture2D & | texture, |
OutputArray | dst | ||
) |
void cv::ogl::convertToGLTexture2D | ( | InputArray | src, |
Texture2D & | texture | ||
) |
void cv::ogl::Buffer::copyFrom | ( | InputArray | arr, |
Target | target = ARRAY_BUFFER , |
||
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
Copies from host/device memory to OpenGL buffer.
arr | Input array (host or device memory, it can be Mat , cuda::GpuMat or std::vector ). |
target | Buffer usage. See cv::ogl::Buffer::Target . |
autoRelease | Auto release mode (if true, release will be called in object's destructor). |
void cv::ogl::Buffer::copyFrom | ( | InputArray | arr, |
cuda::Stream & | stream, | ||
Target | target = ARRAY_BUFFER , |
||
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void cv::ogl::Texture2D::copyFrom | ( | InputArray | arr, |
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
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::Buffer::copyTo | ( | OutputArray | arr | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
Copies from OpenGL buffer to host/device memory or another OpenGL buffer object.
arr | Destination array (host or device memory, can be Mat , cuda::GpuMat , std::vector or ogl::Buffer ). |
void cv::ogl::Buffer::copyTo | ( | OutputArray | arr, |
cuda::Stream & | stream | ||
) | const |
#include <core/include/opencv2/core/opengl.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void cv::ogl::Texture2D::copyTo | ( | OutputArray | arr, |
int | ddepth = CV_32F , |
||
bool | autoRelease = false |
||
) | const |
#include <core/include/opencv2/core/opengl.hpp>
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::Buffer::create | ( | int | arows, |
int | acols, | ||
int | atype, | ||
Target | target = ARRAY_BUFFER , |
||
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
Allocates memory for ogl::Buffer object.
arows | Number of rows in a 2D array. |
acols | Number of columns in a 2D array. |
atype | Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. |
target | Buffer usage. See cv::ogl::Buffer::Target . |
autoRelease | Auto release mode (if true, release will be called in object's destructor). |
void cv::ogl::Buffer::create | ( | Size | asize, |
int | atype, | ||
Target | target = ARRAY_BUFFER , |
||
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
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. |
atype | Array type ( CV_8UC1, ..., CV_64FC4 ). See Mat for details. |
target | Buffer usage. See cv::ogl::Buffer::Target . |
autoRelease | Auto release mode (if true, release will be called in object's destructor). |
void cv::ogl::Texture2D::create | ( | int | arows, |
int | acols, | ||
Format | aformat, | ||
bool | autoRelease = false |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
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). |
#include <core/include/opencv2/core/opengl.hpp>
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). |
int cv::ogl::Buffer::depth | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
int cv::ogl::Buffer::elemSize | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
int cv::ogl::Buffer::elemSize1 | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
bool cv::ogl::Buffer::empty | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
bool cv::ogl::Texture2D::empty | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
bool cv::ogl::Arrays::empty | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
Format cv::ogl::Texture2D::format | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
Context& cv::ogl::ocl::initializeContextFromGL | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Creates OpenCL context from GL.
cuda::GpuMat cv::ogl::Buffer::mapDevice | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
map to device memory (blocking)
cuda::GpuMat cv::ogl::Buffer::mapDevice | ( | cuda::Stream & | stream | ) |
#include <core/include/opencv2/core/opengl.hpp>
Maps OpenGL buffer to CUDA device memory.
This operatation doesn't copy data. Several buffer objects can be mapped to CUDA memory at a time.
A mapped data store must be unmapped with ogl::Buffer::unmapDevice before its buffer object is used.
UMat cv::ogl::mapGLBuffer | ( | const Buffer & | buffer, |
int | accessFlags = ACCESS_READ|ACCESS_WRITE |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
Maps Buffer object to process on CL side (convert to UMat).
Function creates CL buffer from GL one, and then constructs UMat that can be used to process buffer data with OpenCV functions. Note that in current implementation UMat constructed this way doesn't own corresponding GL buffer object, so it is the user responsibility to close down CL/GL buffers relationships by explicitly calling unmapGLBuffer() function.
buffer | - source Buffer object. |
accessFlags | - data access flags (ACCESS_READ|ACCESS_WRITE). |
Mat cv::ogl::Buffer::mapHost | ( | Access | access | ) |
#include <core/include/opencv2/core/opengl.hpp>
Maps OpenGL buffer to host memory.
mapHost maps to the client's address space the entire data store of the buffer object. The data can then be directly read and/or written relative to the returned pointer, depending on the specified access policy.
A mapped data store must be unmapped with ogl::Buffer::unmapHost before its buffer object is used.
This operation can lead to memory transfers between host and device.
Only one buffer object can be mapped at a time.
access | Access policy, indicating whether it will be possible to read from, write to, or both read from and write to the buffer object's mapped data store. The symbolic constant must be ogl::Buffer::READ_ONLY , ogl::Buffer::WRITE_ONLY or ogl::Buffer::READ_WRITE . |
void cv::ogl::Buffer::release | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Decrements the reference counter and destroys the buffer object if needed.
The function will call setAutoRelease(true) .
void cv::ogl::Texture2D::release | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Decrements the reference counter and destroys the texture object if needed.
The function will call setAutoRelease(true) .
void cv::ogl::Arrays::release | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Releases all inner buffers.
void cv::ogl::render | ( | const Texture2D & | tex, |
Rect_< double > | wndRect = Rect_< double >(0.0, 0.0, 1.0, 1.0) , |
||
Rect_< double > | texRect = Rect_< double >(0.0, 0.0, 1.0, 1.0) |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
Render OpenGL texture or primitives.
tex | Texture to draw. |
wndRect | Region of window, where to draw a texture (normalized coordinates). |
texRect | Region of texture to draw (normalized coordinates). |
void cv::ogl::render | ( | const Arrays & | arr, |
int | mode = POINTS , |
||
Scalar | color = Scalar::all(255) |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
arr | Array of privitives vertices. |
mode | Render mode. One of cv::ogl::RenderModes |
color | Color for all vertices. Will be used if arr doesn't contain color array. |
void cv::ogl::render | ( | const Arrays & | arr, |
InputArray | indices, | ||
int | mode = POINTS , |
||
Scalar | color = Scalar::all(255) |
||
) |
#include <core/include/opencv2/core/opengl.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
arr | Array of privitives vertices. |
indices | Array of vertices indices (host or device memory). |
mode | Render mode. One of cv::ogl::RenderModes |
color | Color for all vertices. Will be used if arr doesn't contain color array. |
void cv::ogl::Arrays::resetColorArray | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Resets vertex colors.
void cv::ogl::Arrays::resetNormalArray | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Resets vertex normals.
void cv::ogl::Arrays::resetTexCoordArray | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Resets vertex texture coordinates.
void cv::ogl::Arrays::resetVertexArray | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Resets vertex coordinates.
int cv::ogl::Buffer::rows | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
int cv::ogl::Texture2D::rows | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
void cv::ogl::Buffer::setAutoRelease | ( | bool | flag | ) |
#include <core/include/opencv2/core/opengl.hpp>
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::Buffer doesn't destroy OpenGL object in destructor by default (all OpenGL resources will be released with OpenGL context). This function can force ogl::Buffer destructor to destroy OpenGL object.
flag | Auto release mode (if true, release will be called in object's destructor). |
void cv::ogl::Texture2D::setAutoRelease | ( | bool | flag | ) |
#include <core/include/opencv2/core/opengl.hpp>
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.
void cv::ogl::Arrays::setAutoRelease | ( | bool | flag | ) |
#include <core/include/opencv2/core/opengl.hpp>
Sets auto release mode all inner buffers.
flag | Auto release mode. |
void cv::ogl::Arrays::setColorArray | ( | InputArray | color | ) |
#include <core/include/opencv2/core/opengl.hpp>
Sets an array of vertex colors.
color | array with vertex colors, can be both host and device memory. |
void cv::cuda::setGlDevice | ( | int | device = 0 | ) |
#include <core/include/opencv2/core/opengl.hpp>
Sets a CUDA device and initializes it for the current thread with OpenGL interoperability.
This function should be explicitly called after OpenGL context creation and before any CUDA calls.
device | System index of a CUDA device starting with 0. |
void cv::ogl::Arrays::setNormalArray | ( | InputArray | normal | ) |
#include <core/include/opencv2/core/opengl.hpp>
Sets an array of vertex normals.
normal | array with vertex normals, can be both host and device memory. |
void cv::ogl::Arrays::setTexCoordArray | ( | InputArray | texCoord | ) |
#include <core/include/opencv2/core/opengl.hpp>
Sets an array of vertex texture coordinates.
texCoord | array with vertex texture coordinates, can be both host and device memory. |
void cv::ogl::Arrays::setVertexArray | ( | InputArray | vertex | ) |
#include <core/include/opencv2/core/opengl.hpp>
Sets an array of vertex coordinates.
vertex | array with vertex coordinates, can be both host and device memory. |
Size cv::ogl::Buffer::size | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
Size cv::ogl::Texture2D::size | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
int cv::ogl::Arrays::size | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
Returns the vertex count.
unsigned int cv::ogl::Texture2D::texId | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
get OpenGL opject id
int cv::ogl::Buffer::type | ( | ) | const |
#include <core/include/opencv2/core/opengl.hpp>
|
static |
#include <core/include/opencv2/core/opengl.hpp>
Unbind any buffers from the specified binding point.
target | Binding point. See cv::ogl::Buffer::Target . |
void cv::ogl::Buffer::unmapDevice | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
void cv::ogl::Buffer::unmapDevice | ( | cuda::Stream & | stream | ) |
#include <core/include/opencv2/core/opengl.hpp>
Unmaps OpenGL buffer.
void cv::ogl::unmapGLBuffer | ( | UMat & | u | ) |
#include <core/include/opencv2/core/opengl.hpp>
Unmaps Buffer object (releases UMat, previously mapped from Buffer).
Function must be called explicitly by the user for each UMat previously constructed by the call to mapGLBuffer() function.
u | - source UMat, created by mapGLBuffer(). |
void cv::ogl::Buffer::unmapHost | ( | ) |
#include <core/include/opencv2/core/opengl.hpp>
Unmaps OpenGL buffer.