Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid OpenGL ES2.0 Texture Swapping
    primarykey
    data
    text
    <p>First off I am new to OpenGL, but on my phone (Motorola Bionic) the following code works as intended.</p> <pre><code>GLES20.glActiveTexture(GLES20.GL_TEXTURE1); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTowerTextureHandle); GLES20.glActiveTexture(GLES20.GL_TEXTURE2); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTowerNormalHandle); GLES20.glActiveTexture(GLES20.GL_TEXTURE3); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrostTextureHandle); GLES20.glActiveTexture(GLES20.GL_TEXTURE4); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFrostNormalHandle); GLES20.glActiveTexture(GLES20.GL_TEXTURE5); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFireTextureHandle); GLES20.glActiveTexture(GLES20.GL_TEXTURE6); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFireNormalHandle); ... for (int i =0; i &lt; mGame.towers.length; i++) { switch (mGame.towers[i].type) { case Dart: GLES20.glUniform1i(mTextureUniformHandle, 1); GLES20.glUniform1i(mTextureNormalUniformHandle, 2); break; case Frost: GLES20.glUniform1i(mTextureUniformHandle, 3); GLES20.glUniform1i(mTextureNormalUniformHandle, 4); break; case Fire: GLES20.glUniform1i(mTextureUniformHandle, 5); GLES20.glUniform1i(mTextureNormalUniformHandle, 6); break; } ... GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6); } </code></pre> <p>It will display the correct texture and normal for each tower. On older phones (my friends Incredible) it just display all of the towers with the texture of the last type being drawn. I could just swap in the correct texture to Texture1 for each tower, but isn't that slower and looked down upon?</p> <p>Does anyone have any information as to why it isn't working on some phones and what I need to do to make it compliant across all OpenGLES20 compatible phones?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload