Ejemplo n.º 1
0
        //int _minFilter;
        //int _magFilter;

        public AndroidTexture(AndroidGLGame glGame, string fileName)
        {
            this._glGraphics = glGame.GLGraphics;
            this._fileIO     = glGame.FileIO;
            this._fileName   = fileName;
            Load();
        }
Ejemplo n.º 2
0
        public FirstTriangleScreen(IGame g) : base(g)
        {
            _glGraphics = ((AndroidGLGame)g).GLGraphics;
            ByteBuffer bb = ByteBuffer.AllocateDirect(3 * _vertexSize);

            bb.Order(ByteOrder.NativeOrder());
            _vertices = bb.AsFloatBuffer();
            _vertices.Put(new float[] { 0.0f, 0.0f, 539.0f, 0.0f, 270.0f, 959.0f });
            _vertices.Flip();
        }
Ejemplo n.º 3
0
        public TexturedTriangleScreen(IGame g) : base(g)
        {
            _glGraphics = ((AndroidGLGame)g).GLGraphics;
            ByteBuffer bb = ByteBuffer.AllocateDirect(_vertexSize * 3);

            bb.Order(ByteOrder.NativeOrder());
            _vertices = bb.AsFloatBuffer();
            _vertices.Put(new float[] { 0f, 0f, 0f, 1f, 540f, 0f, 1f, 1f, 270f, 960f, 0.5f, 0f });
            _vertices.Flip();
            _textureId = LoadTexture("bobargb8888.png");
        }
Ejemplo n.º 4
0
        public ColoredTriangleScreen(IGame g) : base(g)
        {
            _glGraphics = ((AndroidGLGame)g).GLGraphics;
            ByteBuffer bb = ByteBuffer.AllocateDirect(3 * _vertexSize);

            bb.Order(ByteOrder.NativeOrder());
            _vertices = bb.AsFloatBuffer();
            _vertices.Put(new float[] { 0, 0, 1, 0, 0, 1,
                                        540, 0, 0, 1, 0, 1,
                                        270, 960, 0, 0, 1, 1 });
            _vertices.Flip();
        }
Ejemplo n.º 5
0
        public IndexedVerticesScreen(IGame g) : base(g)
        {
            _glGraphics = ((AndroidGLGame)g).GLGraphics;
            ByteBuffer bb = ByteBuffer.AllocateDirect(_vertexSize * 4);

            bb.Order(ByteOrder.NativeOrder());
            _vertices = bb.AsFloatBuffer();
            _vertices.Put(new float[] { 100f, 100f, 0f, 1f, 428f, 100f, 1f, 1f, 428f, 428f, 1f, 0f, 100f, 428f, 0f, 0f });
            _vertices.Flip();

            bb = ByteBuffer.AllocateDirect(6 * 2);
            bb.Order(ByteOrder.NativeOrder());
            _indices = bb.AsShortBuffer();
            _indices.Put(new short[] { 0, 1, 2, 2, 3, 0 });
            _indices.Flip();

            _texture = new AndroidTexture((AndroidGLGame)g, "bobrgb888.png");
        }
Ejemplo n.º 6
0
        public AndroidVertices(AndroidGLGraphics glGraphics, int maxVertices, int maxIndices, bool color, bool tecCoords)
        {
            _glGraphics = glGraphics;

            _hasColor     = color;
            _hasTexCoords = tecCoords;
            _vertexSize   = (2 + (_hasColor ? 4 : 0) + (_hasTexCoords ? 2 : 0)) * 4;

            ByteBuffer buffer = ByteBuffer.AllocateDirect(maxVertices * _vertexSize);

            buffer.Order(ByteOrder.NativeOrder());
            _vertices = buffer.AsFloatBuffer();
            if (maxVertices > 0)
            {
                buffer = ByteBuffer.AllocateDirect(maxIndices * 2);
                buffer.Order(ByteOrder.NativeOrder());
                _indices = buffer.AsShortBuffer();
            }
        }
Ejemplo n.º 7
0
        public ModelViewMatrixScreen(IGame g) : base(g)
        {
            AndroidGLGame game = g as AndroidGLGame;

            _glGraphics = game.GLGraphics;
            _texture    = new AndroidTexture(game, "bobrgb888.png");
            _vertices   = new AndroidVertices(_glGraphics, 4, 6, false, true);
            _vertices.SetVertices(new float[] { -32, -32, 0, 1,
                                                32, -32, 1, 1,
                                                32, 32, 1, 0,
                                                -32, 32, 0, 0 }, 0, 16);
            _vertices.SetIndices(new short[] { 0, 1, 2, 2, 3, 0 }, 0, 6);

            _bobs = new BobModel[NUM_BOBS];

            for (int i = 0; i < NUM_BOBS; i++)
            {
                _bobs [i] = new BobModel();
            }
        }
Ejemplo n.º 8
0
        public BlendingScreen(IGame g) : base(g)
        {
            AndroidGLGame game = g as AndroidGLGame;

            _glGraphics  = game.GLGraphics;
            _textureRgb  = new AndroidTexture(game, "bobrgb888.png");
            _textureRgba = new AndroidTexture(game, "bobargb8888.png");
            _vertices    = new AndroidVertices(_glGraphics, 8, 12, true, true);

            float[] rects = new float[] {
                100, 100, 1, 1, 1, 0.5f, 0, 1,
                228, 100, 1, 1, 1, 0.5f, 1, 1,
                228, 228, 1, 1, 1, 0.5f, 1, 0,
                100, 228, 1, 1, 1, 0.5f, 0, 0,

                100, 300, 1, 1, 1, 1f, 0, 1,
                228, 300, 1, 1, 1, 1f, 1, 1,
                228, 428, 1, 1, 1, 1f, 1, 0,
                100, 428, 1, 1, 1, 1f, 0, 0
            };

            _vertices.SetVertices(rects, 0, rects.Length);
            _vertices.SetIndices(new short[] { 0, 1, 2, 2, 3, 0, 4, 5, 6, 6, 7, 4 }, 0, 12);
        }