+
+static bool check_tex_opaque(unsigned int tex)
+{
+ int xsz, ysz;
+ uint32_t *pixels, *pptr;
+
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &xsz);
+ glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &ysz);
+ assert(xsz > 0 && ysz > 0);
+
+ pptr = pixels = new uint32_t[xsz * ysz];
+ glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
+
+ for(int i=0; i<xsz * ysz; i++) {
+ if((*pptr++ & 0xff000000) != 0xff000000) {
+ delete [] pixels;
+ return false;
+ }
+ }
+ delete [] pixels;
+ return true;
+}