Skip to content

Commit 74fcefe

Browse files
author
Andrey Pavlenko
committed
giving a chance for OpenCL 1.1 devices
1 parent 8031742 commit 74fcefe

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

samples/android/tutorial-4-opencl/jni/CLprocessor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#define __CL_ENABLE_EXCEPTIONS
2+
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS /*let's give a chance for OpenCL 1.1 devices*/
23
#include <CL/cl.hpp>
34

45
#include <EGL/egl.h>
@@ -182,12 +183,12 @@ void procOCL_I2I(int texIn, int texOut, int w, int h)
182183
LOGD("enqueueReleaseGLObjects() costs %d ms", getTimeInterval(t));
183184
}
184185

185-
void procOCL_OCV(int tex, int w, int h)
186+
void procOCL_OCV(int texIn, int texOut, int w, int h)
186187
{
187188
if(!haveOpenCL) return;
188189

189190
int64_t t = getTimeMs();
190-
cl::ImageGL imgIn (theContext, CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, tex);
191+
cl::ImageGL imgIn (theContext, CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, texIn);
191192
std::vector < cl::Memory > images(1, imgIn);
192193
theQueue.enqueueAcquireGLObjects(&images);
193194
theQueue.finish();
@@ -204,7 +205,7 @@ void procOCL_OCV(int tex, int w, int h)
204205
LOGD("OpenCV processing costs %d ms", getTimeInterval(t));
205206

206207
t = getTimeMs();
207-
cl::ImageGL imgOut(theContext, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, tex);
208+
cl::ImageGL imgOut(theContext, CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, texOut);
208209
images.clear();
209210
images.push_back(imgOut);
210211
theQueue.enqueueAcquireGLObjects(&images);

samples/android/tutorial-4-opencl/jni/GLrender.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const char vss[] = \
3131
"varying vec2 texCoord;\n" \
3232
"void main() {\n" \
3333
" texCoord = vTexCoord;\n" \
34-
" gl_Position = vec4 ( vPosition, 0.0f, 1.0f );\n" \
34+
" gl_Position = vec4 ( vPosition, 0.0, 1.0 );\n" \
3535
"}";
3636

3737
const char fssOES[] = \
@@ -268,7 +268,7 @@ void drawFrameProcCPU()
268268
}
269269

270270
void procOCL_I2I(int texIn, int texOut, int w, int h);
271-
void procOCL_OCV(int tex, int w, int h);
271+
void procOCL_OCV(int texIn, int texOut, int w, int h);
272272
void drawFrameProcOCL()
273273
{
274274
drawTex(texOES, GL_TEXTURE_EXTERNAL_OES, FBO);
@@ -285,10 +285,10 @@ void drawFrameProcOCLOCV()
285285
drawTex(texOES, GL_TEXTURE_EXTERNAL_OES, FBO);
286286

287287
// modify pixels in FBO texture using OpenCL and CL-GL interop
288-
procOCL_OCV(FBOtex, texWidth, texHeight);
288+
procOCL_OCV(FBOtex, FBOtex2, texWidth, texHeight);
289289

290290
// render to screen
291-
drawTex(FBOtex, GL_TEXTURE_2D, 0);
291+
drawTex(FBOtex2, GL_TEXTURE_2D, 0);
292292
}
293293

294294
extern "C" void drawFrame()

0 commit comments

Comments
 (0)