Hai,
   I want to know about the native opengl es usage with and without
the windowing system of android. Are anybody tried to render using
libGLES_CM.so natively. Anyone have any idea about the windowing
system of android and EGL specific details.
I was testing one small program on android . I got this program from
one of the OpenGL site.
#include <stdio.h>
#include "egl.h"
#include "gl.h"
int main(int argc, char** argv)
{
        EGLConfig myConfig;

        static const char sAppName[] =
                "OpenGL Test (Linux)";
        static EGLConfig sEglConfig;
        EGLBoolean success;
        EGLint numConfigs;
        EGLint majorVersion;
        EGLint minorVersion;
        /*EGLint attrib_list[ ] =
        {
        EGL_RED_SIZE,       8,
        EGL_GREEN_SIZE,     8,
        EGL_BLUE_SIZE,      8,
        EGL_ALPHA_SIZE,     EGL_DONT_CARE,
        EGL_DEPTH_SIZE,     16,
        EGL_STENCIL_SIZE,   EGL_DONT_CARE,
        EGL_SURFACE_TYPE,   EGL_WINDOW_BIT,
        EGL_NONE,           EGL_NONE
        };
        */
        /* EGLint attrib_list[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
        EGL_STENCIL_SIZE, 8, EGL_DEPTH_SIZE, 16,
        EGL_NONE };*/


        EGLint num_config = 1;
        EGLint attrib_list[] = { EGL_ALPHA_SIZE, EGL_DONT_CARE, EGL_RED_SIZE,
5,
                EGL_GREEN_SIZE, 6, EGL_BLUE_SIZE, 5, EGL_DEPTH_SIZE, 16,
                EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_NONE,EGL_NONE };

        EGLDisplay m_eglDisplay = EGL_NO_DISPLAY;
        EGLSurface m_eglSurface = EGL_NO_SURFACE;
        EGLContext m_eglContext = EGL_NO_CONTEXT;

        printf("Trying to get Display!\n");
        m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
        if (m_eglDisplay == EGL_NO_DISPLAY || eglGetError() != EGL_SUCCESS)
                printf("It failed up on eglGetDisplay! %d \n ",eglGetError());
        else
                printf("It passed on eglGetDisplay! %d  %d \n ",
(int)m_eglDisplay,eglGetError());


        printf("Trying to initialize the Display!\n");
        if (eglInitialize(m_eglDisplay, 0, 0) == EGL_FALSE || eglGetError() !
= EGL_SUCCESS)
                printf("It failed up on initializing eglGetDisplay!%d \n
",eglGetError());
        else
                printf("It passed on initializing eglGetDisplay! %d \n
",eglGetError());


        // if (success != EGL_FALSE)
        //   success = eglGetConfigs(m_eglDisplay, NULL, 0, &num_config);
        // if (success != EGL_FALSE)
        {
                success = eglChooseConfig(m_eglDisplay, attrib_list, &myConfig, 
10,
&num_config);
                printf("ChooseConfig %d == %d \n ",success,num_config);
        }

        printf("Trying to get Context!\n");

        m_eglContext = eglCreateContext(m_eglDisplay, myConfig, 0,
attrib_list);
        if (m_eglContext == EGL_NO_CONTEXT || eglGetError() != EGL_SUCCESS)
                printf("It failed up on eglCreateContext! %d \n 
",eglGetError());
        else
                printf("It passed on eglCreateContext! %d \n ",eglGetError());

        m_eglSurface = eglCreateWindowSurface(m_eglDisplay, myConfig,0,
attrib_list);

        printf("Trying to get Surface!\n");
        if (m_eglSurface == EGL_NO_SURFACE || eglGetError() != EGL_SUCCESS)
                printf("It failed up on eglCreateWindowSurface! %d \n
",eglGetError());
        else
                printf("It passed on eglCreateWindowSurface! %d \n 
",eglGetError());






        eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface,
m_eglContext);



        const static GLfloat v[] = {
                0.25, 0.25, 0.0,
                0.75, 0.25, 0.0,
                0.25, 0.75, 0.0,
                0.75, 0.75, 0.0
        };

        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrthof(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
        glVertexPointer(3, GL_FLOAT, 0, v);
        glEnableClientState(GL_VERTEX_ARRAY);

        /// display graphic ///

        glClearColor(0.0, 1.0, 0.0, 1.0);
        glClear(GL_COLOR_BUFFER_BIT);

        glColor4f (1.0, 0.0, 0.0, 1.0);
        glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

        /////
        glFlush();
        eglSwapBuffers(m_eglDisplay, m_eglSurface);  // actually write to the
RGB 16-bit file


        return 0;
}


But it is not succeeding . It is showing error at
eglCreateWindowSurface .
Can anybody help?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Internals" group.
To post to this group, send email to android-internals@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-internals?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to