Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SurfaceFlinger: Failed to find layer & Applying effect in wrong GL context #213

Open
ashwath20 opened this issue Dec 31, 2019 · 16 comments
Open

Comments

@ashwath20
Copy link

...document, PID: 664
    java.lang.RuntimeException: Applying effect in wrong GL context!
        at android.media.effect.EffectContext.assertValidGLState(EffectContext.java:109)
        at android.media.effect.FilterEffect.beginGLEffect(FilterEffect.java:64)
        at android.media.effect.SingleFilterEffect.apply(SingleFilterEffect.java:68)
        at ja.burhanrashid52.photoeditor.ImageFilterView.applyEffect(ImageFilterView.java:263)
        at ja.burhanrashid52.photoeditor.ImageFilterView.onDrawFrame(ImageFilterView.java:100)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)

Does this library support all the android version above 5.0
i am using 8.1.0

@ashwath20 ashwath20 changed the title urfaceFlinger: Failed to find layer & Applying effect in wrong GL context SurfaceFlinger: Failed to find layer & Applying effect in wrong GL context Dec 31, 2019
@ihassanali259
Copy link

I am having the same problem. Did you come up with any solution?

@jomarierafa
Copy link

jomarierafa commented Nov 19, 2020

same issue when using recyclerview

@NahlaSaadAlDeen
Copy link

have anyone find the solution, please?

@adnanbhatti14
Copy link

adnanbhatti14 commented Jul 5, 2022

@NahlaSaadAlDeen I was same issue but now its working fine, OnImageFilterSelected use like below:
override fun onImageFilterSelected(photoFilter: PhotoFilter?) {
hideFilters()
mPhotoEditor?.setFilterEffect(photoFilter)
val saveSettings = SaveSettings.Builder()
.setClearViewsEnabled(true)
.setTransparencyEnabled(true)
.build()
if (mPhotoEditor != null) {
mPhotoEditor?.saveAsFile(
mFilePath,
saveSettings,
object : PhotoEditor.OnSaveListener {
override fun onSuccess(imagePath: String) {

                }

                override fun onFailure(exception: java.lang.Exception) {
                    Toast.makeText(this@SendFileActivity, "failure", Toast.LENGTH_SHORT)
                        .show()
                }
            })
    }
}

@NahlaSaadAlDeen
Copy link

I'v solved it
add the lib as module in the project, update on ImageFilterView class
the update is in this section of code
if (!mInitialized) {
//Only need to do this once
mEffectContext = EffectContext.createWithCurrentGlContext();
mTexRenderer.init();
loadTextures();
mInitialized = true;
}

the solution is : remove the mInitialized condition and let the code in it run without this condition (remove the role of mInitialized)

@VishalNehra
Copy link

@burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view.

@burhanrashid52
Copy link
Owner

@burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view.

Check this comment on issue #242

@VishalNehra
Copy link

@burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view.

Check this comment on issue #242

Worked! Thanks :)

@adnanbhatti14
Copy link

adnanbhatti14 commented Dec 21, 2022 via email

@burhanrashid52
Copy link
Owner

hi, i customize your code like whatsapp photo editor, if you add me to a contributor and allow me then i will push a advanced code Thanks

On Sun, Dec 18, 2022 at 2:56 PM Burhanuddin Rashid @.> wrote: @burhanrashid52 https://github.com/burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view. Check this comment <#242 (comment)> on issue #242 <#242> — Reply to this email directly, view it on GitHub <#213 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKZ5OSTP2KJQ5E22SLCJUDWN3NVVANCNFSM4KBTRFPQ . You are receiving this because you commented.Message ID: @.>

Can you please share the screenshot or video on how it looks and works?

@adnanbhatti14
Copy link

adnanbhatti14 commented Dec 22, 2022 via email

@Akshay-kumar79
Copy link

Hi @adnanbhatti14, Could you please share the solution here as well?

@adnanbhatti14
Copy link

adnanbhatti14 commented Sep 7, 2023 via email

@Akshay-kumar79
Copy link

Hi @adnanbhatti14, Actually I am already done with the project. Thank you for considering this.

@kitet
Copy link

kitet commented Mar 21, 2024

I'v solved it add the lib as module in the project, update on ImageFilterView class the update is in this section of code if (!mInitialized) { //Only need to do this once mEffectContext = EffectContext.createWithCurrentGlContext(); mTexRenderer.init(); loadTextures(); mInitialized = true; }

the solution is : remove the mInitialized condition and let the code in it run without this condition (remove the role of mInitialized)

Thank you @NahlaSaadAlDeen . This issue has cost me some huge amount of time but finally. I imported the library module and updated as advised. Thank you.

@burhanrashid52
Copy link
Owner

burhanrashid52 commented Mar 21, 2024

I'v solved it add the lib as module in the project, update on ImageFilterView class the update is in this section of code if (!mInitialized) { //Only need to do this once mEffectContext = EffectContext.createWithCurrentGlContext(); mTexRenderer.init(); loadTextures(); mInitialized = true; }
the solution is : remove the mInitialized condition and let the code in it run without this condition (remove the role of mInitialized)

Thank you @NahlaSaadAlDeen . This issue has cost me some huge amount of time but finally. I imported the library module and updated as advised. Thank you.

Cool. Would you like to raise a PR for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants