How do I check if I can call glClipControlEXT
in an Android OpenGLES app?
For example:
glClipControlEXT(GL_LOWER_LEFT_EXT, GL_ZERO_TO_ONE_EXT);
Should I enumerate all the extensions (as it done here)?
GLint no_of_extensions = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &no_of_extensions);
std::set<std::string> ogl_extensions;
for (int i = 0; i < no_of_extensions; ++i)
ogl_extensions.insert((const char*)glGetStringi(GL_EXTENSIONS, i));
and find "EXT_clip_control"
?
And how do I get the address of glClipControlEXT
function?
EDIT1:
Tried to add the following to CMake:
add_definitions(-DGL_GLEXT_PROTOTYPES=1)
target_link_libraries(${PROJECT_NAME} PRIVATE GLESv2)
and was able to compile
glClipControlEXT(GL_LOWER_LEFT_EXT, GL_ZERO_TO_ONE_EXT);
in my app, but got linker error:
ld.lld: error: undefined symbol: glClipControlEXT
EDIT2:
Another alternative:
PFNGLCLIPCONTROLEXTPROC myClipControlEXT = (PFNGLCLIPCONTROLEXTPROC)eglGetProcAddress("glClipControlEXT");
myClipControlEXT(GL_LOWER_LEFT_EXT, GL_ZERO_TO_ONE_EXT);
//wglGetProcAddress(“glBlendEquation”)
GLenum tempClipOrigin, tempClipDepth;
glGetIntegerv(GL_CLIP_ORIGIN_EXT, (GLint *)&tempClipOrigin);
glGetIntegerv(GL_CLIP_DEPTH_MODE_EXT, (GLint *)&tempClipDepth);
qDebug() << "GL_CLIP_ORIGIN: " << tempClipOrigin << ", GL_CLIP_DEPTH_MODE: " << tempClipDepth;
Should I enumerate all the extensions ... and find
EXT_clip_control
?
Yes
How do I get the address of the
glClipControlEXT
function?
eglGetProcAccess("glClipControlEXT");
How do I check if I can call glClipControlEXT ...
In general it doesn't seem that widely supported. https://opengles.gpuinfo.org/listextensions.php says its available on 17% of reported devices, although looking at the list most recent ones do.