DavinCode
DavinCode

Reputation: 51

Samsung Galaxy S2 OpenGl ES 2.0 problems

This is my 1st question here. I m new to Android development and i build now a live wallpaper (LiveSpace) I allready uploaded the lite version , you can find it here. https://market.android.com/details?id=thedavincode.alienland&feature=search_result#?t=W251bGwsMSwyLDEsInRoZWRhdmluY29kZS5hbGllbmxhbmQiXQ..

i tested it with Xperia phones and Lg P990 , and it seems to work fine , but there is a weird problem with Galaxy S2. (2.3.4. android) My app has 11 objects(classes) with a texture for each object, and every object has its own program and shaders. galaxy wont render more than 8 textures. it goes from id 0 to 7 and then rest objects apear black. no matter what i ve tried nothing changes. ive read that there is a limit for 8 textures but per shader , not total. Any help would be valueable.. thanks.

Upvotes: 1

Views: 4120

Answers (1)

Krystian Bigaj
Krystian Bigaj

Reputation: 1285

SGS2(Mali400MP) have a limit of a max. 8 texture units. If you are using only single texture in shader, then you could use only one unit. For example:

  1. When you are doing some setup with shader, then bind your texture uniform to first texture unit (0) like: glUniform1i(uTexture, 0); - do it for all of your objects
  2. Before rendering each object bind texture which belongs to it: glBindTexture(GL_TEXTURE_2D , m_texture); - you are binding texture to active texture unit.
  3. As in this case there is used only one texture unit, you can omit glActiveTexture call, as by default first texture unit activated (GL_TEXTURE0)

You should always keep in specification limits if possible, to be compatible with most devices.

Using one texture unit per object/texture is not a way to go.

Upvotes: 1

Related Questions