I was afraid you might say that:
I've gone through and incorporated GLWallpaperService per his
instructions, but specifically I'm getting hung up here:
--QUOTE--
In your GLEngine subclass, instantiate your Renderer, configure it and
set it using setRenderer(Renderer) and setRenderMode(int).
--/QUOTE--
(http://www.rbgrn.net/content/354-glsurfaceview-adapted-3d-live-
wallpapers)

Logcat is throwing a null pointer exception at line 79 in
GLWallpaperService.java which reads as follows:
    ---LOGCAT ERROR--
@Override
public void onSurfaceCreated(SurfaceHolder holder) {
Log.d(TAG, "onSurfaceCreated()");
mGLThread.surfaceCreated(holder);     <--Right Here Line 79
super.onSurfaceCreated(holder);
}
   ---END LOGCAT ERROR---

The following class works perfectly within an Activity for me:
               --BEGIN CLASS--
 public class OpenGLRenderer implements Renderer {
           //Should it be GLSurfaceView.Renderer? <--

        private Square square;
        private float angle = 45f;
        public OpenGLRenderer() {

                square = new Square();
                //I have a square class that defines verts and
such.
 }

        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
                --Clear the screen and prep it--
                }

        public void onDrawFrame(GL10 gl) {
                --This function draws and rotates my object--
        }
public void onSurfaceChanged(GL10 gl, int width, int height) {

                --The code I have here also checks out in an Activity--
        }
    }

                     ---END CLASS---

-My Initial class extends GLWallpaperService --onCreate() as
follows:--

  public void onCreate() {
 GLSurfaceView mGLSurfaceView = new GLSurfaceView(this);
     //I have a feeling this is misplaced.
}


--My subclass extends GLEngine--

class CubeEngine extends GLEngine {
        private final Runnable mDrawCube = new Runnable() {
            public void run() {
                //Does Nothing ATM
            }
        };
        private boolean mVisible;


        CubeEngine() {
            //Blank Constructor
        }

        @Override
        public void onCreate(SurfaceHolder surfaceHolder) {
            super.onCreate(surfaceHolder);

           mGLSurfaceView.setRenderer(new OpenGLRenderer());
                //This setRenderer is what I need help with.



            // By default we don't get touch events, so enable them.
            setTouchEventsEnabled(true);
        }


               --I don't think I need to override the
                 things like onSurfaceChanged here, because
                 I think that my OpenGLRenderer Class
                 handles that, or at least it should.  --


Thanks for being patient with me. I'll sort it all out in time I'm
sure.
Just getting an OpenGL object to work correctly in a regular Activity
was
a giant leap!

Josh Beck
Northeast ISD
Humble Android Apprentice.



On Feb 14, 3:03 am, Lance Nanek <[email protected]> wrote:
> http://groups.google.com/group/android-developers/browse_thread/threa...
>
> On Feb 14, 3:06 am, joshbeck <[email protected]> wrote:
>
>
>
> > Hello all,
>
> > I can construct an Activity that utilized OpenGL to draw a square, set
> > properties, and
> > make it rotate around a fixed point by implementing
> > android.opengl.GLSurfaceView,Renderer
> > and configuring:
>
> > public void onSurfaceCreated(GL10 gl, EGLConfig config) {}
>
> > public void onDrawFrame(GL10 gl) {}
>
> > public void onSurfaceChanged(GL10 gl, int width, int height) {}
>
> > -----Separately----
>
> > I can construct a live wallpaper by drawing an image (Bitmap) to a
> > Canvas
> > as specified at:
>
> >http://developer.android.com/resources/samples/CubeLiveWallpaper/inde...
>
> > My Question:
>
> > I'm trying to figure out how to create a GLSurface and draw to it
> > within a Live Wallpaper.
> > I'm all about doing research. So, any advice is appreciated.
>
> > The Simple Cube wallpaper demo Google provided was VERY helpful.
> > I think a lot of folks would like to see something along those except
> > with an OpenGL cube in mind.
>
> > --Much appreciated. I'm totally new to OpenGL.
>
> > Josh Beck

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