Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
8ed45609
Commit
8ed45609
authored
Jun 29, 2015
by
Alexey Ershov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed cleanup, fixed unused context
parent
3f687870
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
opengl_interop.cpp
samples/opengl/opengl_interop.cpp
+11
-20
winapp.hpp
samples/opengl/winapp.hpp
+10
-0
No files found.
samples/opengl/opengl_interop.cpp
View file @
8ed45609
...
...
@@ -42,19 +42,14 @@ public:
~
GLWinApp
()
{}
int
onClose
(
void
)
virtual
void
cleanup
(
)
{
m_shutdown
=
true
;
cleanup
();
#if defined(WIN32) || defined(_WIN32)
::
DestroyWindow
(
m_hWnd
);
#elif defined(__linux__)
#if defined(__linux__)
glXMakeCurrent
(
m_display
,
None
,
NULL
);
glXDestroyContext
(
m_display
,
m_glctx
);
XDestroyWindow
(
m_display
,
m_window
);
XCloseDisplay
(
m_display
);
#endif
return
0
;
WinApp
::
cleanup
()
;
}
#if defined(WIN32) || defined(_WIN32)
...
...
@@ -75,12 +70,14 @@ public:
}
else
if
(
wParam
==
VK_ESCAPE
)
{
return
onClose
();
cleanup
();
return
0
;
}
break
;
case
WM_CLOSE
:
return
onClose
();
cleanup
();
return
0
;
case
WM_DESTROY
:
::
PostQuitMessage
(
0
);
...
...
@@ -117,7 +114,7 @@ public:
if
((
Atom
)
e
.
xclient
.
data
.
l
[
0
]
==
m_WM_DELETE_WINDOW
)
{
m_end_loop
=
true
;
onClose
();
cleanup
();
}
else
{
...
...
@@ -144,7 +141,7 @@ public:
break
;
case
XK_Escape
:
m_end_loop
=
true
;
onClose
();
cleanup
();
break
;
}
break
;
...
...
@@ -155,7 +152,7 @@ public:
}
#endif
int
init
(
void
)
int
init
()
{
#if defined(WIN32) || defined(_WIN32)
m_hDC
=
GetDC
(
m_hWnd
);
...
...
@@ -180,7 +177,7 @@ public:
if
(
cv
::
ocl
::
haveOpenCL
())
{
m_oclCtx
=
cv
::
ogl
::
ocl
::
initializeContextFromGL
();
(
void
)
cv
::
ogl
::
ocl
::
initializeContextFromGL
();
}
m_oclDevName
=
cv
::
ocl
::
useOpenCL
()
?
...
...
@@ -342,11 +339,6 @@ public:
return
0
;
}
int
cleanup
(
void
)
{
return
0
;
}
protected
:
#if defined(WIN32) || defined(_WIN32)
...
...
@@ -415,7 +407,6 @@ private:
cv
::
VideoCapture
m_cap
;
cv
::
Mat
m_frame_bgr
;
cv
::
Mat
m_frame_rgba
;
cv
::
ocl
::
Context
m_oclCtx
;
cv
::
String
m_oclDevName
;
};
...
...
samples/opengl/winapp.hpp
View file @
8ed45609
...
...
@@ -116,6 +116,16 @@ public:
return
init
();
}
virtual
void
cleanup
()
{
#if defined(WIN32) || defined(_WIN32)
::
DestroyWindow
(
m_hWnd
);
#elif defined(__linux__)
XDestroyWindow
(
m_display
,
m_window
);
XCloseDisplay
(
m_display
);
#endif
}
#if defined(WIN32) || defined(_WIN32)
virtual
LRESULT
CALLBACK
WndProc
(
HWND
hWnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
=
0
;
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment