43 #ifndef OPENCV_CORE_OPENGL_HPP
44 #define OPENCV_CORE_OPENGL_HPP
47 # error opengl.hpp header must be compiled as C++
50 #include "opencv2/core.hpp"
53 namespace cv {
namespace ogl {
86 ARRAY_BUFFER = 0x8892,
87 ELEMENT_ARRAY_BUFFER = 0x8893,
88 PIXEL_PACK_BUFFER = 0x88EB,
89 PIXEL_UNPACK_BUFFER = 0x88EC
113 Buffer(
int arows,
int acols,
int atype,
unsigned int abufId,
bool autoRelease =
false);
121 Buffer(
Size asize,
int atype,
unsigned int abufId,
bool autoRelease =
false);
130 Buffer(
int arows,
int acols,
int atype,
Target target = ARRAY_BUFFER,
bool autoRelease =
false);
155 void create(
int arows,
int acols,
int atype,
Target target = ARRAY_BUFFER,
bool autoRelease =
false);
163 void create(
Size asize,
int atype,
Target target = ARRAY_BUFFER,
bool autoRelease =
false);
291 DEPTH_COMPONENT = 0x1902,
304 Texture2D(
int arows,
int acols,
Format aformat,
unsigned int atexId,
bool autoRelease =
false);
337 void create(
int arows,
int acols,
Format aformat,
bool autoRelease =
false);
564 namespace cv {
namespace cuda {
583 cv::ogl::Buffer::Buffer(
int arows,
int acols,
int atype, Target target,
bool autoRelease) : rows_(0), cols_(0), type_(0)
585 create(arows, acols, atype, target, autoRelease);
591 create(asize, atype, target, autoRelease);
597 create(asize.height, asize.width, atype, target, autoRelease);
615 return Size(cols_, rows_);
621 return rows_ == 0 || cols_ == 0;
659 create(arows, acols, aformat, autoRelease);
665 create(asize, aformat, autoRelease);
671 create(asize.height, asize.width, aformat, autoRelease);
689 return Size(cols_, rows_);
695 return rows_ == 0 || cols_ == 0;
707 #if defined _MSC_VER && _MSC_VER >= 1920
708 #pragma warning(push)
709 #pragma warning(disable: 4702)
715 #if defined _MSC_VER && _MSC_VER >= 1920
n-dimensional dense array class
Definition: mat.hpp:812
Template class for 2D rectangles.
Definition: types.hpp:444
static Scalar_< double > all(double v0)
returns a scalar with all elements set to v0
Template class for specifying the size of an image or rectangle.
Definition: types.hpp:335
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:296
Base storage class for GPU memory with reference counting.
Definition: cuda.hpp:106
This class encapsulates a queue of asynchronous calls.
Definition: cuda.hpp:908
Wrapper for OpenGL Client-Side Vertex arrays.
Definition: opengl.hpp:407
void bind() const
Binds all vertex arrays.
void release()
Releases all inner buffers.
void resetNormalArray()
Resets vertex normals.
void resetTexCoordArray()
Resets vertex texture coordinates.
void resetColorArray()
Resets vertex colors.
void resetVertexArray()
Resets vertex coordinates.
void setTexCoordArray(InputArray texCoord)
Sets an array of vertex texture coordinates.
void setAutoRelease(bool flag)
Sets auto release mode all inner buffers.
void setVertexArray(InputArray vertex)
Sets an array of vertex coordinates.
int size() const
Returns the vertex count.
void setNormalArray(InputArray normal)
Sets an array of vertex normals.
void setColorArray(InputArray color)
Sets an array of vertex colors.
Arrays()
Default constructor.
Smart pointer for OpenGL buffer object with reference counting.
Definition: opengl.hpp:80
Buffer(Size asize, int atype, unsigned int abufId, bool autoRelease=false)
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
Allocates memory for ogl::Buffer object.
void create(Size asize, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
void unmapDevice(cuda::Stream &stream)
Unmaps OpenGL buffer.
void copyTo(OutputArray arr) const
Copies from OpenGL buffer to host/device memory or another OpenGL buffer object.
Mat mapHost(Access access)
Maps OpenGL buffer to host memory.
void bind(Target target) const
Binds OpenGL buffer to the specified buffer binding point.
void copyTo(OutputArray arr, cuda::Stream &stream) const
cuda::GpuMat mapDevice()
map to device memory (blocking)
Access
Definition: opengl.hpp:93
Buffer(InputArray arr, Target target=ARRAY_BUFFER, bool autoRelease=false)
Target
The target defines how you intend to use the buffer object.
Definition: opengl.hpp:85
void unmapHost()
Unmaps OpenGL buffer.
static void unbind(Target target)
Unbind any buffers from the specified binding point.
Buffer(int arows, int acols, int atype, unsigned int abufId, bool autoRelease=false)
Buffer clone(Target target=ARRAY_BUFFER, bool autoRelease=false) const
Creates a full copy of the buffer object and the underlying data.
void release()
Decrements the reference counter and destroys the buffer object if needed.
cuda::GpuMat mapDevice(cuda::Stream &stream)
Maps OpenGL buffer to CUDA device memory.
void copyFrom(InputArray arr, Target target=ARRAY_BUFFER, bool autoRelease=false)
Copies from host/device memory to OpenGL buffer.
unsigned int bufId() const
get OpenGL opject id
void copyFrom(InputArray arr, cuda::Stream &stream, Target target=ARRAY_BUFFER, bool autoRelease=false)
Buffer()
The constructors.
Buffer(Size asize, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
Buffer(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
void setAutoRelease(bool flag)
Sets auto release mode.
Smart pointer for OpenGL 2D texture memory with reference counting.
Definition: opengl.hpp:284
Texture2D(int arows, int acols, Format aformat, unsigned int atexId, bool autoRelease=false)
Format
An Image Format describes the way that the images in Textures store their data.
Definition: opengl.hpp:289
Texture2D(int arows, int acols, Format aformat, bool autoRelease=false)
void copyTo(OutputArray arr, int ddepth=CV_32F, bool autoRelease=false) const
Copies from OpenGL texture to host/device memory or another OpenGL texture object.
Texture2D(Size asize, Format aformat, bool autoRelease=false)
Texture2D(Size asize, Format aformat, unsigned int atexId, bool autoRelease=false)
void create(int arows, int acols, Format aformat, bool autoRelease=false)
Allocates memory for ogl::Texture2D object.
Texture2D(InputArray arr, bool autoRelease=false)
Texture2D()
The constructors.
void release()
Decrements the reference counter and destroys the texture object if needed.
void bind() const
Binds texture to current active texture unit for GL_TEXTURE_2D target.
void copyFrom(InputArray arr, bool autoRelease=false)
Copies from host/device memory to OpenGL texture.
void setAutoRelease(bool flag)
Sets auto release mode.
unsigned int texId() const
get OpenGL opject id
void create(Size asize, Format aformat, bool autoRelease=false)
Size2i Size
Definition: types.hpp:370
AccessFlag
Definition: mat.hpp:65
CV__DEBUG_NS_END typedef const _InputArray & InputArray
Definition: mat.hpp:442
@ ACCESS_READ
Definition: mat.hpp:65
@ ACCESS_WRITE
Definition: mat.hpp:65
CvArr * arr
Definition: core_c.h:1247
#define CV_MAT_DEPTH(flags)
Definition: interface.h:83
#define CV_32F
Definition: interface.h:78
CV_EXPORTS UMat mapGLBuffer(const Buffer &buffer, AccessFlag accessFlags=ACCESS_READ|ACCESS_WRITE)
Maps Buffer object to process on CL side (convert to UMat).
CV_EXPORTS void convertFromGLTexture2D(const Texture2D &texture, OutputArray dst)
Converts Texture2D object to OutputArray.
CV_EXPORTS void 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 convertToGLTexture2D(InputArray src, Texture2D &texture)
Converts InputArray to Texture2D object.
CV_EXPORTS void setGlDevice(int device=0)
Sets a CUDA device and initializes it for the current thread with OpenGL interoperability.
RenderModes
render mode
Definition: opengl.hpp:478
CV_EXPORTS void unmapGLBuffer(UMat &u)
Unmaps Buffer object (releases UMat, previously mapped from Buffer).
@ TRIANGLE_FAN
Definition: opengl.hpp:485
@ QUADS
Definition: opengl.hpp:486
@ LINE_STRIP
Definition: opengl.hpp:482
@ POINTS
Definition: opengl.hpp:479
@ POLYGON
Definition: opengl.hpp:488
@ LINES
Definition: opengl.hpp:480
@ QUAD_STRIP
Definition: opengl.hpp:487
@ TRIANGLES
Definition: opengl.hpp:483
@ TRIANGLE_STRIP
Definition: opengl.hpp:484
@ LINE_LOOP
Definition: opengl.hpp:481
#define CV_EXPORTS
Definition: cvdef.h:435
#define CV_ELEM_SIZE1(type)
Definition: cvdef.h:508
#define CV_MAT_CN(flags)
Definition: cvdef.h:495
#define CV_ELEM_SIZE(type)
Definition: cvdef.h:510
CvPoint CvPoint CvScalar color
Definition: imgproc_c.h:968
CvPoint CvPoint void * buffer
Definition: imgproc_c.h:357
OutputArray dst
Definition: imgproc.hpp:3564
CV_EXPORTS Context & initializeContextFromGL()
Creates OpenCL context from GL.
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441