Android device - C++ OpenGL 2: eglCreateWindowSurface invalid

Posted by ThreaderSlash on Game Development See other posts from Game Development or by ThreaderSlash
Published on 2012-04-07T19:49:08Z Indexed on 2012/04/07 23:45 UTC
Read the original article Hit count: 411

Filed under:
|
|
|

I am trying to debug and run OGLES on Native C++ in my Android device in order to implement a native 3D game for mobile smart phones. The point is that I got an error and see no reason for that. Here is the line from the code that the debugger complains:

    mSurface = eglCreateWindowSurface(mDisplay, 
                                      lConfig, mApplication->window, NULL);

And this is the error message:

    Invalid arguments ' Candidates are: 
        void * eglCreateWindowSurface(void *, void *, 
                                      unsigned long int, const int *) '

--x--

Here is the declaration:

    android_app* mApplication;

    EGLDisplay mDisplay;
    EGLint lFormat, lNumConfigs, lErrorResult;
    EGLConfig lConfig;
    // Defines display requirements. 16bits mode here.
    const EGLint lAttributes[] = {
        EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
        EGL_BLUE_SIZE, 5, EGL_GREEN_SIZE, 6, EGL_RED_SIZE, 5,
        EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDER_BUFFER, EGL_BACK_BUFFER,
        EGL_NONE
    };
    // Retrieves a display connection and initializes it.
    packt_Log_debug("Connecting to the display.");
    mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    if (mDisplay == EGL_NO_DISPLAY) goto ERROR;
    if (!eglInitialize(mDisplay, NULL, NULL)) goto ERROR;
    // Selects the first OpenGL configuration found.
    packt_Log_debug("Selecting a display config.");
    if(!eglChooseConfig(mDisplay, lAttributes, &lConfig, 1,
        &lNumConfigs) || (lNumConfigs <= 0)) goto ERROR;
    // Reconfigures the Android window with the EGL format.
    packt_Log_debug("Configuring window format.");
    if (!eglGetConfigAttrib(mDisplay, lConfig,
        EGL_NATIVE_VISUAL_ID, &lFormat)) goto ERROR;
    ANativeWindow_setBuffersGeometry(mApplication->window, 0, 0, lFormat);
    // Creates the display surface.
    packt_Log_debug("Initializing the display.");
    mSurface = eglCreateWindowSurface(mDisplay, lConfig, mApplication->window, NULL);

--x--

Hope someone here can shed some light on it.

© Game Development or respective owner

Related posts about c++

Related posts about android