3

It seems my power-of-2 textures show up completely white. This application works on various devices, even Nexus 7 but Galaxy Nexus phone seems to produce white textures. This is probably related to PowerVR gpu.

I can interact with the app, everything seems in-place but the textures aren't rendering.

I've tried various EGLConfigs and it seems that nothing works.

Here is how I generate my textures, notice no mipmaps:

glGenTextures( 1, &TextureId );
glBindTexture( GL_TEXTURE_2D, TextureId );
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,Width,Height,0,GL_RGBA,GL_UNSIGNED_BYTE,Data);

Also, GL_TEXTURE_2D is enabled.

  • Textures are all power of 2 (64x512,1024x1024 etc).
  • None of the textures exceed 1024x1024 even though device supports 2048x2048
  • There are no glError()s and no eglError()s.
  • Color works and I can interact with my app
  • There are no errors with eglMakeCurrent or eglCreateContext
  • Works on all other devices I've tried with (emulator,Nexus 7(Tegra),Sony Xperia 10(Adreno 200),Galaxy S2(Mali GPU))
  • I use interleaved VBO for drawing
  • glEnable(GL_TEXTURE_2D); is set
  • Assets are placed in the assets folder
  • All OpenGL operations occur on the same context and thread

UPDATE: glGenTextures() returns huge numbers.

Rolling a custom texture iterator, I was able to get it working. I would still like to figure out why glGenTextures doesn't work. Here is the code:

GLuint TextureId;
glGenTextures( 1, &TextureId );

TextureId can be in billions. This only happens on Nexus Phone, all of the other devices gave me correct texture ids (1,2,3,4,etc..)

Any suggestions?

Grapes
  • 2,473
  • 3
  • 26
  • 42
  • Might have to do with mipmapping. Are you trying to mipmap a non-square texture? Are you generating mipmaps in hardware or software? Or it could be resource scaling. Where are images stored? If they are in your resources directories, you need to put it in `drawable-nodpi` to avoid unexpected scaling. A 1024x1024 image in the drawable or drawable-mdpi directories will be loaded with much bigger dimensions on Galaxy Nexus. – Tenfour04 Dec 11 '13 at 16:34
  • @Tenfour04 As mentioned, no mipmaps, textures are being stored in assets folder. – Grapes Dec 11 '13 at 16:35
  • Oops, missed that. o'__'o – Tenfour04 Dec 11 '13 at 16:36
  • Isn't `TextureId` just a "name" for the texture? The GLES spec says that there's no guarantee that contiguous integers are used for all the texture names. http://www.khronos.org/opengles/sdk/1.1/docs/man/ I also imagine that the names must not match any of the GL constants to avoid any confusion there. The error may caused somewhere else. – Tenfour04 Dec 11 '13 at 16:49
  • @Tenfour04 Right, but all of my other devices seem to return correct sequence (starting from 1). If I write my own id and increment it by 1, it solves the problem. Very strange. I also checked the thread and all OpenGL operations occur on the same context/thread. – Grapes Dec 11 '13 at 17:40
  • Weird. You might try the LibGDX forums. The developers behind it have seen it all, I'm sure.\ – Tenfour04 Dec 11 '13 at 17:54
  • @Grapes : Can you please post the solution , how did you generate the texture ids ? – Anukool Apr 04 '14 at 05:50

0 Answers0