コード例 #1
0
            // ===========================================================
            // Getter & Setter
            // ===========================================================

            // ===========================================================
            // Methods for/from SuperClass/Interfaces
            // ===========================================================

            public /* override */ void OnSurfaceChanged(GL10 pGL, int pWidth, int pHeight)
            {
                Debug.D("onSurfaceChanged: pWidth=" + pWidth + "  pHeight=" + pHeight);
                this.mEngine.SetSurfaceSize(pWidth, pHeight);
                pGL.GlViewport(0, 0, pWidth, pHeight);
                pGL.GlLoadIdentity();
            }
コード例 #2
0
            public /* override */ void OnSurfaceCreated(GL10 pGL, EGLConfig pConfig)
            {
                Debug.D("onSurfaceCreated");
                GLHelper.Reset(pGL);

                GLHelper.SetPerspectiveCorrectionHintFastest(pGL);
                //			pGL.glEnable(GL10.GL_POLYGON_SMOOTH);
                //			pGL.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST);
                //			pGL.glEnable(GL10.GL_LINE_SMOOTH);
                //			pGL.glHint(GL10.GL_LINE_SMOOTH_HINT, GL10.GL_NICEST);
                //			pGL.glEnable(GL10.GL_POINT_SMOOTH);
                //			pGL.glHint(GL10.GL_POINT_SMOOTH_HINT, GL10.GL_NICEST);

                GLHelper.SetShadeModelFlat(pGL);

                GLHelper.DisableLightning(pGL);
                GLHelper.DisableDither(pGL);
                GLHelper.DisableDepthTest(pGL);
                GLHelper.DisableMultisample(pGL);

                GLHelper.EnableBlend(pGL);
                GLHelper.EnableTextures(pGL);
                GLHelper.EnableTexCoordArray(pGL);
                GLHelper.EnableVertexArray(pGL);

                GLHelper.EnableCulling(pGL);
                pGL.GlFrontFace(GL10Consts.GlCcw);
                pGL.GlCullFace(GL10Consts.GlBack);

                // GLHelper.EnableExtensions(pGL, this.mEngine.getEngineOptions().getRenderOptions());
                GLHelper.EnableExtensions(pGL, this.mEngine.EngineOptions.RenderOptions);
            }
コード例 #3
0
            //@Override
            public void OnPostExecute(T result)
            {
                try {
                    this.mPD.Dismiss();
                } catch (Exception e) {
                    Debug.E("Error", e);
                    /* Nothing. */
                }

                if (this.IsCancelled)
                {
                    this.mException = new CancelledException();
                }

                if (this.mException == null)
                {
                    pCallback.OnCallback(result);
                }
                else
                {
                    if (pExceptionCallback == null)
                    {
                        Debug.E("Error", this.mException);
                    }
                    else
                    {
                        pExceptionCallback.OnCallback(this.mException);
                    }
                }

                base.OnPostExecute(result);
            }
コード例 #4
0
ファイル: GLHelper.cs プロジェクト: slagusev/AndEngine.net
        public static void EnableExtensions(/* final */ GL10 pGL, /* final */ RenderOptions pRenderOptions)
        {
            /* final */
            String version = pGL.GlGetString(GL10Consts.GlVersion);
            /* final */
            String renderer = pGL.GlGetString(GL10Consts.GlRenderer);
            /* final */
            String extensions = pGL.GlGetString(GL10Consts.GlExtensions);

            Debug.D("RENDERER: " + renderer);
            Debug.D("VERSION: " + version);
            Debug.D("EXTENSIONS: " + extensions);

            /* final */
            bool isOpenGL10 = version.Contains("1.0");
            /* final */
            bool isSoftwareRenderer = renderer.Contains("PixelFlinger");
            /* final */
            bool isVBOCapable = extensions.Contains("_vertex_buffer_object");
            /* final */
            bool isDrawTextureCapable = extensions.Contains("draw_texture");

            //GLHelper.EXTENSIONS_VERTEXBUFFEROBJECTS = !pRenderOptions.isDisableExtensionVertexBufferObjects() && !isSoftwareRenderer && (isVBOCapable || !isOpenGL10);
            GLHelper.EXTENSIONS_VERTEXBUFFEROBJECTS = !pRenderOptions.IsDisableExtensionVertexBufferObjects() && !isSoftwareRenderer && (isVBOCapable || !isOpenGL10);
            GLHelper.EXTENSIONS_DRAWTEXTURE         = isDrawTextureCapable;

            GLHelper.HackBrokenDevices();
            Debug.D("EXTENSIONS_VERXTEXBUFFEROBJECTS = " + GLHelper.EXTENSIONS_VERTEXBUFFEROBJECTS);
            Debug.D("EXTENSIONS_DRAWTEXTURE = " + GLHelper.EXTENSIONS_DRAWTEXTURE);
        }
コード例 #5
0
        // ===========================================================
        // Constructors
        // ===========================================================

        public AssetTextureSource(Context pContext, String pAssetPath)
        {
            this.mContext   = pContext;
            this.mAssetPath = pAssetPath;

            BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
            decodeOptions.InJustDecodeBounds = true;

            //InputStream input = null;
            System.IO.Stream input = null;
            try
            {
                //input = pContext.getAssets().open(pAssetPath);
                input = pContext.Assets.Open(pAssetPath);
                BitmapFactory.DecodeStream(input, null, decodeOptions);
            }
            catch (IOException e)
            {
                Debug.E("Failed loading Bitmap in AssetTextureSource. AssetPath: " + pAssetPath, e);
            }
            finally
            {
                StreamUtils.CloseStream(input);
            }

            this.mWidth  = decodeOptions.OutWidth;
            this.mHeight = decodeOptions.OutHeight;
        }
コード例 #6
0
 public void OnCallback(T result)
 {
     try {
         pd.Dismiss();
     } catch (Exception e) {
         Debug.E("Error", e);
     }
 }
コード例 #7
0
 public /* override */ void OnDrawFrame(GL10 pGL)
 {
     try
     {
         this.mEngine.OnDrawFrame(pGL);
     }
     catch (InterruptedException e)
     {
         Debug.E("GLThread interrupted!", e);
     }
 }
コード例 #8
0
ファイル: Texture.cs プロジェクト: slagusev/AndEngine.net
        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;
                        }
                    }
                }
            }
        }
コード例 #9
0
        public /* override */ virtual Bitmap OnLoadBitmap()
        {
            System.IO.Stream input = null;
            //InputStream input = null;
            try
            {
                BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
                decodeOptions.InPreferredConfig = Config.Argb8888;

                //input = this.mContext.getAssets().open(this.mAssetPath);
                input = this.mContext.Assets.Open(this.mAssetPath);
                return(BitmapFactory.DecodeStream(input, null, decodeOptions));
            }
            catch (IOException e)
            {
                Debug.E("Failed loading Bitmap in AssetTextureSource. AssetPath: " + this.mAssetPath, e);
                return(null);
            }
            finally
            {
                //StreamUtils.closeStream(input);
            }
        }
コード例 #10
0
ファイル: Texture.cs プロジェクト: slagusev/AndEngine.net
 public /* override */ virtual void OnUnloadedFromHardware(Texture pTexture)
 {
     Debug.D("Texture unloaded: " + pTexture.ToString());
 }
コード例 #11
0
ファイル: Texture.cs プロジェクト: slagusev/AndEngine.net
 public /* override */ virtual void OnTextureSourceLoadExeption(Texture pTexture, ITextureSource pTextureSource, Throwable pThrowable)
 {
     Debug.E("Exception loading TextureSource. Texture: " + pTexture.ToString() + " TextureSource: " + pTextureSource, pThrowable);
 }
コード例 #12
0
ファイル: Texture.cs プロジェクト: slagusev/AndEngine.net
 public /* override */ virtual void OnLoadedToHardware(Texture pTexture)
 {
     Debug.D("Texture loaded: " + pTexture.ToString());
 }