2

I am using OpenGL ES 1.1 with the NDK and occasionally when I call glGenTextures it does not change the value of name holder that I pass in (doesn't even set it to 0).

  • glGetError returns 0, no error.
  • All GL code is in a JNI method called from onDrawFrame of the surface renderer so the context shouldn't be a problem. (edit: this was a wrong assumption and was the cause of the problem)
  • The code works in some cases and not others. If I repeat the call each frame it works after about 5 tries. (I am generating glyphs on request).
  • The first lot of textures get created up to at least #32 but after that it is hit and miss.

Does anyone know of a reason why glGenTextures would appear to do nothing?

DrYap
  • 6,525
  • 2
  • 31
  • 54

1 Answers1

3

Is glGenTextures called with a valid OpenGL(-ES) context being active? If you're using multiple threads: A OpenGL(-ES) context can be active in only one thread at a time. But each thread may have a different context active.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Yes, the problem was that the resize call (where font size changed and glyphs need to be reloaded) was invoked from the UI thread not the GL thread. This explains why it worked on my computer as the UI and GL thread are the same in that implementation. – DrYap Oct 22 '12 at 16:23