Determining capabilities and extensions

The OpenGL ES specifications define the minimum set of requirements for a company that implements the APIs must meet, but an implementation may extend beyond the minimum requirements to provide additional functionality. Each implementation may vary based on the version of the specification implemented, the graphics hardware, and OS version the device is running. So, the capabilities between implementations vary. Let's look at how to determine the capabilities.

Determine implementation-dependent values

OpenGL ES has specific values that show its capabilities on a device. You must query the capabilities to make sure that you don't exceed the limits of a particular value, such as the number of blue bitplanes you use in the color buffer. We obtain all of the following constants by querying the appropriate glGet*() function. We determine the appropriate function from the return value that we expect.

The following table shows constants that describe some capabilities of either version of OpenGL ES on your device
Constant Description
GL_ALPHA_BITS The number of alpha bitplanes in the color buffer
GL_BLUE_BITS The number of blue bitplanes in the color buffer
GL_DEPTH_BITS The number of bitplanes in the depth buffer
GL_GREEN_BITS The number of green bitplanes in the color buffer
GL_MAX_TEXTURE_SIZE The number of texture units supported
GL_RED_BITS The number of red bitplanes in the color buffer
GL_STENCIL_BITS The number of bitplanes in the stencil buffer
The following table shows constants that describe some capabilities of OpenGL ES 1.1 on your device
The constant Description
GL_MAX_CLIP_PLANES The maximum number of application-defined clipping planes
GL_MAX_LIGHTS The maximum number of lights
GL_MAX_MODELVIEW_STACK_DEPTH The maximum supported depth of the modelview matrix stack
GL_MAX_PROJECTION_STACK_DEPTH The maximum supported depth of the projection matrix stack
GL_MAX_TEXTURE_SIZE An estimate of the largest texture that the OpenGL ES implementation can handle
GL_MAX_TEXTURE_STACK_DEPTH The maximum supported depth of the texture matrix stack
GL_MAX_VIEWPORT_DIMS The maximum supported width and height of the viewport
The following table shows constants that describe some capabilities of OpenGL ES 2.0 on your device
The constant Description
GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS The maximum number of supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined
GL_MAX_CUBE_MAP_TEXTURE_SIZE A estimate of the largest cube-map texture that the OpenGL ES implementation can handle
GL_MAX_FRAGMENT_UNIFORM_VECTORS The maximum number of four-element vectors that can be held in uniform variable storage for a fragment shader
GL_MAX_RENDERBUFFER_SIZE The largest render buffer width and height that the OpenGL ES implementation can handle
GL_MAX_TEXTURE_IMAGE_UNITS The maximum supported texture image units that can be used to access texture maps from the fragment shader
GL_MAX_VARYING_VECTORS The maximum number of four-element floating-point vectors available for interpolating varying variables
GL_MAX_VERTEX_ATTRIBS The maximum number of four-component generic vertex attributes
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS The maximum number of supported texture image units that can be used to access texture maps from the vertex shader
GL_MAX_VERTEX_UNIFORM_VECTORS The maximum number of four-element vectors that can be held in uniform variable storage for a vertex shader

For more information, take a look at the OpenGL ES 1.1 manual pages, the OpenGL ES 2.0 manual pages, or the OpenGL ES 3.0 manual pages.

Get version information

You can use the glGetString() function to obtain information about the vendor, the renderer used, and version information. The function accepts a constant as a parameter and returns a string that describes the current OpenGL ES configuration.

Constant Description
GL_VENDOR The company responsible for the implementation
GL_RENDERER The name of the renderer used
GL_VERSION A version or release number
GL_SHADING_LANGUAGE_VERSION A version or release number for the shading language
GL_EXTENSIONS A space-separated list of supported extensions

Check for OpenGL ES extensions

You can determine the available OpenGL ES extensions at any time with the following code:

	char *extensions = (char *) glGetString(GL_EXTENSIONS);

Extensions are specific to the OpenGL ES implementation on the hardware platform.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus