Skip to content

Instantly share code, notes, and snippets.

@arturoc
Created June 18, 2015 10:24
Show Gist options
  • Save arturoc/e6ebdb036e3a4268db4f to your computer and use it in GitHub Desktop.
Save arturoc/e6ebdb036e3a4268db4f to your computer and use it in GitHub Desktop.
EGLContext context = eglGetCurrentContext();
EGLDisplay eglDisplay = eglGetCurrentDisplay();
glBindTexture(GL_TEXTURE_2D, 0);
EGLint imageAttributes[] = {
EGL_GL_TEXTURE_LEVEL_KHR, 0, // mip map level to reference
EGL_IMAGE_PRESERVED_KHR, EGL_FALSE,
EGL_NONE
};
EGLImageKHR (*eglCreateImageKHR)(EGLDisplay,EGLContext,int,EGLClientBuffer,EGLint*);
get_egl_extension("eglCreateImageKHR",eglCreateImageKHR);
void (*eglDestroyImageKHR)() = eglGetProcAddress("eglDestroyImageKHR");
if(eglCreateImageKHR==NULL){
ofLogError()<<"eglCreateImageKHR not found";
}else{
eglImage = eglCreateImageKHR(eglDisplay, context, EGL_GL_TEXTURE_2D_KHR,
reinterpret_cast<EGLClientBuffer>(&windowBuffer),
imageAttributes);
if (eglImage == EGL_NO_IMAGE_KHR){
ofLogError() << "Create EGLImage FAIL";
return;
}else{
ofLogNotice() << "Create EGLImage PASS";
}
currentPathTexture->bind();
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglImage);
currentPathTexture-Zunbind();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment