OpenCV  3.0.0-rc1
Open Source Computer Vision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Enumerations | Functions
OpenGL interoperability

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...
 

Enumerations

enum  cv::ogl::RenderModes {
  cv::ogl::POINTS = 0x0000,
  cv::ogl::LINES = 0x0001,
  cv::ogl::LINE_LOOP = 0x0002,
  cv::ogl::LINE_STRIP = 0x0003,
  cv::ogl::TRIANGLES = 0x0004,
  cv::ogl::TRIANGLE_STRIP = 0x0005,
  cv::ogl::TRIANGLE_FAN = 0x0006,
  cv::ogl::QUADS = 0x0007,
  cv::ogl::QUAD_STRIP = 0x0008,
  cv::ogl::POLYGON = 0x0009
}
 render mode More...
 

Functions

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))
 
void cv::ogl::render (const Arrays &arr, InputArray indices, int mode=POINTS, Scalar color=Scalar::all(255))
 
void cv::cuda::setGlDevice (int device=0)
 Sets a CUDA device and initializes it for the current thread with OpenGL interoperability. More...
 

Detailed Description

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).

Enumeration Type Documentation

render mode

Enumerator
POINTS 
LINES 
LINE_LOOP 
LINE_STRIP 
TRIANGLES 
TRIANGLE_STRIP 
TRIANGLE_FAN 
QUADS 
QUAD_STRIP 
POLYGON 

Function Documentation

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.

Parameters
texTexture to draw.
wndRectRegion of window, where to draw a texture (normalized coordinates).
texRectRegion of texture to draw (normalized coordinates).
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.

Parameters
arrArray of privitives vertices.
modeRender mode. One of cv::ogl::RenderModes
colorColor 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) 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
arrArray of privitives vertices.
indicesArray of vertices indices (host or device memory).
modeRender mode. One of cv::ogl::RenderModes
colorColor for all vertices. Will be used if arr doesn't contain color array.
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.

Parameters
deviceSystem index of a CUDA device starting with 0.