1

How I used glTexStorage

#define GL_GLEXT_PROTOTYPES
#include <gl2ext.h>

So glTexStorage2DEXT is direct symbol. However I also checked eglGetProcAddress(), they are the same address.

Code snippet :

glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

Then this gives GL_INVALID_OPERATION on glTexSubImage2D:

glTexStorage2DEXT(GL_TEXTURE_2D, 1, GL_RGBA8_OES, w, h);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, data);

But this doesn't give error:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, data);

What's wrong with my use of glTexStorage2DEXT?

keaukraine
  • 5,315
  • 29
  • 54
user2771324
  • 307
  • 3
  • 13

1 Answers1

0

Stop using the extension. It is a standard part of GL ES 3 (which the nexus 7 supports) so just use:

glTexStorage2D

(ie without the EXT!)

Goz
  • 61,365
  • 24
  • 124
  • 204
  • I am currently targeting ES2, because I don't know how to cleanly handle ES2/3 in one native program. (I don't quite like the ndk gles3 sample which have the whole rendering implemented twice in ES2/3.) If I include ES3 .h and avoid ES3-only API/format calls at runtime, can my program run on ES2 devices? – user2771324 May 18 '14 at 10:16