updated OpenGL functionality:

* removed OpenGLFuncTab, now extensions are loaded internally
* added support of GlBuffer and GlTexture2D to InputArray/OutputArray
* added ELEMENT_ARRAY_BUFFER and PIXEL_PACK_BUFFER targets
* added copyFrom/copyTo method for GlBuffer and GlTexture2D
* removed GlFont
* removed pointCloudShow
* removed OpenGLCleanCallback
* added Access parameter to GlBuffer::mapHost
* added autoRelease parameter to all create methods
This commit is contained in:
Vladislav Vinogradov
2013-02-19 14:13:11 +04:00
parent 39baa2237e
commit e06c3ec7c5
21 changed files with 5875 additions and 2960 deletions

View File

@@ -3,7 +3,6 @@
#include "cvconfig.h"
#include "opencv2/core/core.hpp"
#include "opencv2/core/opengl_interop.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/video/video.hpp"
@@ -66,40 +65,6 @@ static void drawArrows(Mat& frame, const vector<Point2f>& prevPts, const vector<
}
}
#ifdef HAVE_OPENGL
struct DrawData
{
GlTexture tex;
GlArrays arr;
};
static void drawCallback(void* userdata)
{
DrawData* data = static_cast<DrawData*>(userdata);
if (data->tex.empty() || data->arr.empty())
return;
static GlCamera camera;
static bool init_camera = true;
if (init_camera)
{
camera.setOrthoProjection(0.0, 1.0, 1.0, 0.0, 0.0, 1.0);
camera.lookAt(Point3d(0.0, 0.0, 1.0), Point3d(0.0, 0.0, 0.0), Point3d(0.0, 1.0, 0.0));
init_camera = false;
}
camera.setupProjectionMatrix();
camera.setupModelViewMatrix();
render(data->tex);
render(data->arr, RenderMode::TRIANGLES);
}
#endif
template <typename T> inline T clamp (T x, T a, T b)
{
return ((x) > (a) ? ((x) < (b) ? (x) : (b)) : (a));
@@ -200,12 +165,6 @@ int main(int argc, const char* argv[])
namedWindow("PyrLK [Sparse]", WINDOW_NORMAL);
namedWindow("PyrLK [Dense] Flow Field", WINDOW_NORMAL);
#ifdef HAVE_OPENGL
namedWindow("PyrLK [Dense]", WINDOW_OPENGL);
setGlDevice();
#endif
cout << "Image size : " << frame0.cols << " x " << frame0.rows << endl;
cout << "Points count : " << points << endl;
@@ -271,21 +230,6 @@ int main(int argc, const char* argv[])
imshow("PyrLK [Dense] Flow Field", flowField);
#ifdef HAVE_OPENGL
setOpenGlContext("PyrLK [Dense]");
GpuMat d_vertex, d_colors;
createOpticalFlowNeedleMap(d_u, d_v, d_vertex, d_colors);
DrawData drawData;
drawData.tex.copyFrom(d_frame0Gray);
drawData.arr.setVertexArray(d_vertex);
drawData.arr.setColorArray(d_colors, false);
setOpenGlDrawCallback("PyrLK [Dense]", drawCallback, &drawData);
#endif
waitKey();
return 0;