Exemplo n.º 1
0
  /**
   * Binds the textures to an OpenGL texturing target. Called every frame by {@link
   * RajawaliScene#render(double, rajawali.renderer.RenderTarget)}. Shouldn't be called manually.
   */
  public void bindTextures() {
    int num = mTextureList.size();

    for (int i = 0; i < num; i++) {
      ATexture texture = mTextureList.get(i);
      bindTextureByName(texture.getTextureName(), i, texture);
      GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + i);
      GLES20.glBindTexture(texture.getGLTextureType(), texture.getTextureId());
      GLES20.glUniform1i(GLES20.glGetUniformLocation(mProgramHandle, texture.getTextureName()), i);
    }

    if (mPlugins != null) for (IMaterialPlugin plugin : mPlugins) plugin.bindTextures(num);
  }
Exemplo n.º 2
0
 /**
  * Copies every property from another ATexture object
  *
  * @param other another ATexture object to copy from
  */
 public void setFrom(ATexture other) {
   mTextureId = other.getTextureId();
   mUniformHandle = other.getUniformHandle();
   mWidth = other.getWidth();
   mHeight = other.getHeight();
   mBitmapFormat = other.getBitmapFormat();
   mMipmap = other.isMipmap();
   mShouldRecycle = other.willRecycle();
   mTextureName = other.getTextureName();
   mTextureType = other.getTextureType();
   mWrapType = other.getWrapType();
   mFilterType = other.getFilterType();
   mBitmapConfig = other.getBitmapConfig();
   mCompressedTexture = other.getCompressedTexture();
   mGLTextureType = other.getGLTextureType();
 }
Exemplo n.º 3
0
 public void bindTextureByName(String name, int index, ATexture texture) {
   GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + index);
   GLES20.glBindTexture(texture.getGLTextureType(), texture.getTextureId());
   GLES20.glUniform1i(GLES20.glGetUniformLocation(mProgramHandle, name), index);
 }