Hi All,

This is the implementation of my SurfaceView Class

@Override
        public void surfaceCreated(SurfaceHolder holder)
        {
                Log.v("My3DClass", "surfaceCreated");
                egl = (EGL10)EGLContext.getEGL();

                if(egl == null)
                        Log.v("Error","unable to load EGL");
                EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

                if(dpy == null)
                        Log.v("Error","unable to load Display");

                int[] version = new int[2];
        egl.eglInitialize(dpy, version);
        if(version[0]<1)
                Log.v("Error"," unable to initilize version ");

        int[] configSpec = {
                        EGL10.EGL_RED_SIZE, 5,
                        EGL10.EGL_GREEN_SIZE, 6,
                        EGL10.EGL_BLUE_SIZE, 5,
                //EGL10.EGL_ALPHA_SIZE, 0,
                EGL10.EGL_DEPTH_SIZE, 16,
                // EGL11.EGL_STENCIL_SIZE, EGL11.EGL_DONT_CARE,   //
don't care about stencils
                EGL10.EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT,
                EGL10.EGL_NONE

        };
        EGLConfig[] configs = new EGLConfig[1];
        int[] num_config = new int[1];
        if(!egl.eglChooseConfig(dpy, configSpec, configs, 1,
num_config))
                Log.v("Error","unable to choose Config ");

        EGLConfig config = configs[0];
        EGLContext ctx = egl.eglCreateContext(dpy, config,
                        EGL10.EGL_NO_CONTEXT, null);
        if(ctx == null)
                Log.v("Error","unable to create context");

        EGLSurface surface = egl.eglCreateWindowSurface(dpy, config,
                        this, null);

        if(surface == null)
                Log.v("Error","unable to create surface");

        if(!egl.eglMakeCurrent(dpy, surface, surface, ctx))
                Log.v("Error","unable to make surface current");
        mEglContext = ctx;
        mEglDisplay = dpy;
        mEglSurface = surface;
        }

@Override
        public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2,
int arg3)
        {
                        gl = (GL10)mEglContext.getGL();
                        if(gl == null)
                                Log.v("Error","unable to load G L");
                        gl.glViewport(0, 0, getWidth(),getHeight());
                        gl.glDisable(GL10.GL_DITHER);
                gl.glClearColor(0,1,1,0);
                gl.glEnable(GL10.GL_SCISSOR_TEST);
                gl.glScissor(0, 0, arg2, arg3);
                gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

                        egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null);
                gl.glMatrixMode(GL10.GL_PROJECTION);
                gl.glLoadIdentity();
                GLU.gluPerspective(gl, 45f, getWidth()/getHeight(), 0.1f,
100);

                gl.glMatrixMode(GL10.GL_MODELVIEW);
                mAnimate = true;
                Draw3D();
        }

public void Draw3D()
        {
                        egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null);
                        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | 
GL10.GL_DEPTH_BUFFER_BIT);
                        gl.glLoadIdentity();
                        GLU.gluLookAt(gl, 0, 0, -20, 0, 0, 0, 0, 1, 0);
                gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
                gl.glFrontFace(GL10.GL_CCW);
                gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexBuffer);
                gl.glDrawElements(GL10.GL_TRIANGLE_STRIP, 3,
GL10.GL_UNSIGNED_SHORT, mIndexBuffer);

                egl.eglWaitGL();
                egl.eglSwapBuffers(mEglDisplay, mEglSurface);
        }

@Override
        public void run()
{
while(true)
{
Draw3D();
}



i don't find my screen rendering... is there any problem in my code...
Please suggest...



thanks & regards,
K.Prabhakar
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to