String is correct on using the matrix stack.  Follow those
instructions and also consider just creating a textured quad and
rendering it in an orthographic projection.  That's a common practice
for a nice, fast, easy background on a 3D scene.  If you want it to
look far away just blur and darken it in your favorite 2d graphic
editor.

If you don't know how to set the projection to orthographic or create
a quad or set texture coordinates, etc, consider getting the red or
blue book on OpenGL.  It's an excellent investment for your first GL
project.

On Apr 28, 2:32 am, String <sterling.ud...@googlemail.com> wrote:
> 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 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
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