diff options
| author | Jamie Gennis <jgennis@google.com> | 2011-09-28 12:13:31 -0700 |
|---|---|---|
| committer | Jamie Gennis <jgennis@google.com> | 2011-09-30 14:19:41 -0700 |
| commit | 8606fefa219d63d0a0f3df1b9dcf49cfbfa5b3e5 (patch) | |
| tree | b2d21dc0e83e944c544937be3bbf91e76ae9e875 /libs/gui/SurfaceTexture.cpp | |
| parent | ce0a7ade96ddbdcb342e0b382e9d3ea43962cafd (diff) | |
| download | frameworks_base-8606fefa219d63d0a0f3df1b9dcf49cfbfa5b3e5.zip frameworks_base-8606fefa219d63d0a0f3df1b9dcf49cfbfa5b3e5.tar.gz frameworks_base-8606fefa219d63d0a0f3df1b9dcf49cfbfa5b3e5.tar.bz2 | |
SurfaceTexture: parameterize the texture target
This change adds a hack to allow Android Browser to use a SurfaceTexture
to stream RGBA images to a GL_TEXTURE_2D texture object.
Change-Id: Idb90064d5d4b920959ef3be7451362ac5012460e
Diffstat (limited to 'libs/gui/SurfaceTexture.cpp')
| -rw-r--r-- | libs/gui/SurfaceTexture.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index dac9418..c72a45b 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -94,7 +94,8 @@ static int32_t createProcessUniqueId() { return android_atomic_inc(&globalCounter); } -SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode) : +SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode, + GLenum texTarget) : mDefaultWidth(1), mDefaultHeight(1), mPixelFormat(PIXEL_FORMAT_RGBA_8888), @@ -110,7 +111,8 @@ SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode) : mSynchronousMode(false), mAllowSynchronousMode(allowSynchronousMode), mConnectedApi(NO_CONNECTED_API), - mAbandoned(false) { + mAbandoned(false), + mTexTarget(texTarget) { // Choose a name using the PID and a process-unique ID. mName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId()); @@ -698,9 +700,8 @@ status_t SurfaceTexture::updateTexImage() { ST_LOGW("updateTexImage: clearing GL error: %#04x", error); } - glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName); - glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, - (GLeglImageOES)image); + glBindTexture(mTexTarget, mTexName); + glEGLImageTargetTexture2DOES(mTexTarget, (GLeglImageOES)image); bool failed = false; while ((error = glGetError()) != GL_NO_ERROR) { @@ -735,7 +736,7 @@ status_t SurfaceTexture::updateTexImage() { mDequeueCondition.signal(); } else { // We always bind the texture even if we don't update its contents. - glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName); + glBindTexture(mTexTarget, mTexName); } return OK; @@ -761,7 +762,7 @@ bool SurfaceTexture::isExternalFormat(uint32_t format) } GLenum SurfaceTexture::getCurrentTextureTarget() const { - return GL_TEXTURE_EXTERNAL_OES; + return mTexTarget; } void SurfaceTexture::getTransformMatrix(float mtx[16]) { |
