It is the case of creating 3D views, which is what that i am trying to
do ..

For setting the background with a color (equivalent of
setBackgroundColor), using
glClearColor(float red, float green, float blue, float alpha)
with the right values does the trick in the function
public void surfaceCreated(GL10 gl)

Regarding the setBackgroundResource, it could be possible using a
sprite with the texture set from that resource !! placing the sprite
to appear as if it were to be background seems to be tricky part.

Can you comment if there is a alternate better way ?

-Dan

On Mar 27, 12:16 am, Dianne Hackborn <[email protected]> wrote:
> No a surface view punches a whole through your window at its location to let
> the surface be seen.  Its whole point is that you have complete, direct
> access to the surface/pixels inside of it.  If you are wanting to do
> something like this, you might want to think about whether you want a
> surface view at all.  I have been getting the impression that a number of
> people are using it just because it sounds like it will let them draw
> outside of updates...  that's not really its purpose, it's a specialized API
> for things like video playback, high performance games, etc, things that
> want to render all of the pixels themselves.
>
>
>
> On Fri, Mar 27, 2009 at 12:13 AM, Dan Raaka <[email protected]> wrote:
>
> > In the APIDemos
>
> >    protected void onCreate(Bundle savedInstanceState) {
> >        super.onCreate(savedInstanceState);
>
> >        // Create our Preview view and set it as the content of our
> >        // Activity
> >        mGLSurfaceView = new GLSurfaceView(this);
> >        mGLSurfaceView.setRenderer(new CubeRenderer(false));
> >        setContentView(mGLSurfaceView);
> >    }
>
> > works fine as expected .. however .. adding a line like
> >    protected void onCreate(Bundle savedInstanceState) {
> >        super.onCreate(savedInstanceState);
>
> >        // Create our Preview view and set it as the content of our
> >        // Activity
> >        mGLSurfaceView = new GLSurfaceView(this);
> >        mGLSurfaceView.setBackgroundColor(Color.RED);
> >        //mGLSurfaceView.setBackgroundResource(R.drawable.sample01);
> >        mGLSurfaceView.setRenderer(new CubeRenderer(false));
> >        setContentView(mGLSurfaceView);
> >    }
> > Does render on the screen as if the background was over-layed on top
> > of the cube !! I suspect the cube is still being rendered but behind
> > the RED background.
>
> > Is there a way to set the background of the SurfaceView just like a 2D
> > view ?
>
> > -Dan
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to