Reputation: 1313
I have a funny event with one application in development using OpenGL ES on native NDK C++ for Android. The program compiles and runs with no problem. However if I decide to make a unit test and debug the code, it complains with the following message:
Invalid arguments ' Candidates are:
void * eglCreateWindowSurface(void *, void *, unsigned long int,
const int *) '
Which is related to the last line from the following code snapshot:
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);
I already looked on OGLES references, but all different things I tried did not work out yet.
Upvotes: 2
Views: 2935
Reputation: 1313
Replacing 'mApplication->window' for 'EGLNativeWindowType window' solved the problem.
Upvotes: 3