I'm trying to get a simple test app going that I've built using the San Angeles demo as a reference. Currently (in my native/cpp code) I'm only calling glViewport on resize, and glClearColor and glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) when rendering a frame. Problems occur when loading the opengl lib dynamically (via dlopen("libGLESv1_CM.so", RTLD_NOW)); dl open is successful and I find the symbols, however the screen stays black even though I've set my clear colour to green. On the other hand, if I don't import the symbols, things seem to work fine.
I've gone through the San Angeles demo a few times now and can't see what I might have missed. Any ideas/advice are much appreciated. My import code is below:
uint32 ImportOpenGL()
{
uint32 uResult = 0;
glesLib = dlopen("libGLESv1_CM.so", RTLD_NOW);
if (!glesLib)
return 1;
#define GL_IMPORT_FUNC(funcName) \
{ \
*((void **)&(funcPtr_##funcName)) = (void *)dlsym(glesLib, #funcName); \
if(!funcPtr_##funcName) \
{ \
LOGW("Could not load OpenGL symbol: %s", #funcName); \
uResult = (!uResult ? 2 : uResult); \
} \
}
GL_IMPORT_FUNC(glBlendFunc);
GL_IMPORT_FUNC(glClear);
GL_IMPORT_FUNC(glClearColorx);
GL_IMPORT_FUNC(glClearColor);
GL_IMPORT_FUNC(glColor4x);
GL_IMPORT_FUNC(glColorPointer);
GL_IMPORT_FUNC(glDisable);
GL_IMPORT_FUNC(glDisableClientState);
GL_IMPORT_FUNC(glDrawArrays);
GL_IMPORT_FUNC(glEnable);
GL_IMPORT_FUNC(glEnableClientState);
GL_IMPORT_FUNC(glFrustumx);
GL_IMPORT_FUNC(glGetError);
GL_IMPORT_FUNC(glLightxv);
GL_IMPORT_FUNC(glLoadIdentity);
GL_IMPORT_FUNC(glMaterialx);
GL_IMPORT_FUNC(glMaterialxv);
GL_IMPORT_FUNC(glMatrixMode);
GL_IMPORT_FUNC(glMultMatrixx);
GL_IMPORT_FUNC(glNormalPointer);
GL_IMPORT_FUNC(glPopMatrix);
GL_IMPORT_FUNC(glPushMatrix);
GL_IMPORT_FUNC(glRotatex);
GL_IMPORT_FUNC(glScalex);
GL_IMPORT_FUNC(glShadeModel);
GL_IMPORT_FUNC(glTranslatex);
GL_IMPORT_FUNC(glVertexPointer);
GL_IMPORT_FUNC(glViewport);
#undef GL_IMPORT_FUNC
if(!uResult)
{
LOGI("Successfully imported OpenGL symbols");
}
return uResult;
}