private static void SendPlaceholderBitmapToHardware(int pWidth, int pHeight) { Bitmap textureBitmap = Bitmap.CreateBitmap(pWidth, pHeight, Bitmap.Config.Argb8888); GLUtils.TexImage2D(GL10Consts.GlTexture2d, 0, textureBitmap, 0); textureBitmap.Recycle(); }
private void WriteTextureToHardware(GL10 pGL) { bool preMultipyAlpha = this.mTextureOptions.mPreMultipyAlpha; //final ArrayList<TextureSourceWithLocation> textureSources = this.mTextureSources; List <TextureSourceWithLocation> textureSources = this.mTextureSources; int textureSourceCount = textureSources.Count; for (int j = 0; j < textureSourceCount; j++) { TextureSourceWithLocation textureSourceWithLocation = textureSources[j]; if (textureSourceWithLocation != null) { Bitmap bmp = textureSourceWithLocation.OnLoadBitmap(); try { if (bmp == null) { throw new IllegalArgumentException("TextureSource: " + textureSourceWithLocation.ToString() + " returned a null Bitmap."); } if (preMultipyAlpha) { GLUtils.TexSubImage2D(GL10Consts.GlTexture2d, 0, textureSourceWithLocation.GetTexturePositionX(), textureSourceWithLocation.GetTexturePositionY(), bmp, GL10Consts.GlRgba, GL10Consts.GlUnsignedByte); } else { GLHelper.GlTexSubImage2D(pGL, GL10Consts.GlTexture2d, 0, textureSourceWithLocation.GetTexturePositionX(), textureSourceWithLocation.GetTexturePositionY(), bmp, GL10Consts.GlRgba, GL10Consts.GlUnsignedByte); } bmp.Recycle(); } catch (IllegalArgumentException iae) { // TODO Load some static checkerboard or so to visualize that loading the texture has failed. Debug.E("Error loading: " + textureSourceWithLocation.ToString(), iae); if (this.mTextureStateListener != null) { this.mTextureStateListener.OnTextureSourceLoadExeption(this, textureSourceWithLocation.mTextureSource, iae); } else { throw iae; } } } } }