|
enum | cv::ogl::RenderModes {
POINTS = 0x0000
, LINES = 0x0001
, LINE_LOOP = 0x0002
, LINE_STRIP = 0x0003
,
TRIANGLES = 0x0004
, TRIANGLE_STRIP = 0x0005
, TRIANGLE_FAN = 0x0006
, QUADS = 0x0007
,
QUAD_STRIP = 0x0008
, POLYGON = 0x0009
} |
| render mode
|
|
|
CV_EXPORTS 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. [詳解]
|
|
CV_EXPORTS void | cv::ogl::render (const Arrays &arr, int mode=POINTS, Scalar color=Scalar::all(255)) |
|
CV_EXPORTS void | cv::ogl::render (const Arrays &arr, InputArray indices, int mode=POINTS, Scalar color=Scalar::all(255)) |
|
CV_EXPORTS void | cv::ogl::convertToGLTexture2D (InputArray src, Texture2D &texture) |
| Converts InputArray to Texture2D object. [詳解]
|
|
CV_EXPORTS void | cv::ogl::convertFromGLTexture2D (const Texture2D &texture, OutputArray dst) |
| Converts Texture2D object to OutputArray. [詳解]
|
|
CV_EXPORTS UMat | cv::ogl::mapGLBuffer (const Buffer &buffer, AccessFlag accessFlags=ACCESS_READ|ACCESS_WRITE) |
| Maps Buffer object to process on CL side (convert to UMat). [詳解]
|
|
CV_EXPORTS void | cv::ogl::unmapGLBuffer (UMat &u) |
| Unmaps Buffer object (releases UMat, previously mapped from Buffer). [詳解]
|
|
CV_EXPORTS void | cv::cuda::setGlDevice (int device=0) |
| Sets a CUDA device and initializes it for the current thread with OpenGL interoperability. [詳解]
|
|
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).
◆ convertFromGLTexture2D()
Converts Texture2D object to OutputArray.
- 引数
-
texture | - source Texture2D object. |
dst | - destination OutputArray. |
◆ convertToGLTexture2D()
CV_EXPORTS void cv::ogl::convertToGLTexture2D |
( |
InputArray |
src, |
|
|
Texture2D & |
texture |
|
) |
| |
Converts InputArray to Texture2D object.
- 引数
-
src | - source InputArray. |
texture | - destination Texture2D object. |
◆ mapGLBuffer()
CV_EXPORTS UMat cv::ogl::mapGLBuffer |
( |
const Buffer & |
buffer, |
|
|
AccessFlag |
accessFlags = ACCESS_READ|ACCESS_WRITE |
|
) |
| |
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). |
- 戻り値
- Returns UMat object
◆ render() [1/3]
CV_EXPORTS void cv::ogl::render |
( |
const Arrays & |
arr, |
|
|
InputArray |
indices, |
|
|
int |
mode = POINTS , |
|
|
Scalar |
color = Scalar::all(255) |
|
) |
| |
これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
- 引数
-
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. |
◆ render() [2/3]
これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
- 引数
-
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. |
◆ render() [3/3]
CV_EXPORTS 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.
- 引数
-
tex | Texture to draw. |
wndRect | Region of window, where to draw a texture (normalized coordinates). |
texRect | Region of texture to draw (normalized coordinates). |
◆ setGlDevice()
CV_EXPORTS void cv::cuda::setGlDevice |
( |
int |
device = 0 | ) |
|
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. |
◆ unmapGLBuffer()
CV_EXPORTS void cv::ogl::unmapGLBuffer |
( |
UMat & |
u | ) |
|
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.
- 引数
-