emulator opengl: added Bind texture to EGLImage/surface

added functionality to bind an EGLImage to a texture both
in the system and host sides.

Change-Id: I2dc26090b45da080ac4d0e8f5799c95f7cc54634
This commit is contained in:
Stas Gurtovoy
2011-05-15 11:29:56 +03:00
committed by Guy Zadickario
parent a26f6f221b
commit 2220d27302
13 changed files with 153 additions and 25 deletions

View File

@@ -97,6 +97,7 @@ bool FrameBuffer::initialize(FBNativeWindowType p_window,
//
if (!init_egl_dispatch()) {
// Failed to load EGL
printf("Failed to init_egl_dispatch\n");
return false;
}
@@ -105,6 +106,7 @@ bool FrameBuffer::initialize(FBNativeWindowType p_window,
//
if (!init_gl_dispatch()) {
// Failed to load GLES
printf("Failed to init_gl_dispatch\n");
return false;
}
@@ -113,6 +115,7 @@ bool FrameBuffer::initialize(FBNativeWindowType p_window,
//
FrameBuffer *fb = new FrameBuffer(p_x, p_y, p_width, p_height);
if (!fb) {
printf("Fialed to create fb\n");
return false;
}
@@ -135,6 +138,7 @@ bool FrameBuffer::initialize(FBNativeWindowType p_window,
//
fb->m_eglDisplay = s_egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (fb->m_eglDisplay == EGL_NO_DISPLAY) {
printf("Failed to Initialize backend EGL display\n");
delete fb;
return false;
}
@@ -172,6 +176,7 @@ bool FrameBuffer::initialize(FBNativeWindowType p_window,
int n;
if (!s_egl.eglChooseConfig(fb->m_eglDisplay, configAttribs,
&eglConfig, 1, &n)) {
printf("Failed on eglChooseConfig\n");
delete fb;
return false;
}
@@ -420,6 +425,19 @@ bool FrameBuffer::setWindowSurfaceColorBuffer(HandleType p_surface,
return true;
}
bool FrameBuffer::bindColorBufferToTexture(HandleType p_colorbuffer)
{
android::Mutex::Autolock mutex(m_lock);
ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) );
if (c == m_colorbuffers.end()) {
// bad colorbuffer handle
return false;
}
return (*c).second->bindToTexture();
}
bool FrameBuffer::bindContext(HandleType p_context,
HandleType p_drawSurface,
HandleType p_readSurface)