On Apr 26, 7:24 am, CMF <manf...@gmail.com> wrote:

> Hi all, I would like to ask how to add a static background to the kube
> from the ApiDemo

There are two ways that immediately occur to me. First, make it
translucent and put it on top of a view containing your background
image. See
com.example.android.apis.graphics.TranslucentGLSurfaceViewActivity for
an example.

> I have created a sqaure behind the Kube, but it will rotate as the
> kube does

And this is the other approach. To make the cube rotate independently
of your background, you should be able to restore the unrotated model-
view matrix before your background-rendering code. Something like
this:

        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
        gl.glTranslatef(0, 0, -3.0f);
        gl.glScalef(0.5f, 0.5f, 0.5f);

        gl.glPushMatrix();  // This saves the unrotated matrix
        gl.glRotatef(mAngle,        0, 1, 0);
        gl.glRotatef(mAngle*0.25f,  1, 0, 0);
        mWorld.draw(gl);
        gl.glPopMatrix();  // This restores the unrotated matrix

        // Put your background-drawing code here

I haven't tested the above code (it was written on the fly for this
response) but that's the basic idea. I use that technique in a couple
of places in various OpenGL apps.

String

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to