Wednesday, May 8, 2013

Re: [android-developers] Switching between GLES2.0 and native Canvas rendering on the fly works in 2.3.6 but no in 4.2.2

If you want to use Canvas and OpenGL at the same time, why not just do something like this?


    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        mView = new BasicGLSurfaceView(getApplication());
        setContentView(mView);
        
        Button b = new Button(this);
        b.setText("hmm");
        
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(200,200);
        
        addContentView(b, params);
        
    }




The button is drawn using Canvas, and the background is drawn using OpenGL.  Of course, instead of using a Button, you would use your own subclass of View and size it accordingly.

Thanks.


On Tuesday, May 7, 2013 12:53:37 PM UTC-5, Alex Rempel wrote:
But GLES to Canvas works fine on all versions, it's the other way around?

Thx for the answers if you really meant Canvas to GLES.
That's a shame though, because as far as I know you can switch the GLES.EGL contexts on a single display (here: Surface) without any problems, provided these are unlocked carefully.


On Tuesday, May 7, 2013 5:32:18 PM UTC+2, Romain Guy (Google) wrote:


> 1. There is no drawing with GLES and Canvas at the same time

I understand but that is not supported. Once you've rendered in a Surface with OpenGL it cannot be used with Canvas.

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment