Check if device supports a certain GL extension?

So I was testing my app that uses a fullscreen rendertarget on an old android tablet (Nexus 7), and it turns out that device doesn’t support non-power-of-two textures. (The screen is just black, unless I feed it a PoT texture.) I’m prepping to render to a nearest-PoT sized texture on all devices just for compatibility, but it would be nice if I only had to do that logic on devices that required it – ie, devices that don’t support GL_OES_texture_npot. Is there any Defold API call to check extensions?

Btw, not my question here, but if anyone else has this problem, here’s how to render to a larger texture but only show the screen’s portion:

  • when creating RT, use screen size next-highest PoT for width/height
  • (on “window_resized” msg, delete RT and recreate if PoTs change)
  • when rendering to RT, set viewport to screen size
  • when rendering RT to screen, set viewport to RT’s PoT sizes
  • then when rendering GUI layers, set VP again to screen size

This works for me for now. Actually, it’s probably more performant than using a NPOT texture because I don’t delete and resize on every single window resize, instead only if a different size is needed. Hell, could even only resize if a larger size is needed and keep that. :wink: If we had draw scissoring, even better.

There is no API to check extensions as far as I know. @sven, do you have any input here?