예제 #1
0
        /**
         * For use with pre-converted data. This is 50x faster than
         * {@link #put(float[])}, and 500x faster than
         * {@link FloatBuffer#put(float[])}, so if you've got float[] data that
         * won't change, {@link #convert(float...)} it to an int[] once and use this
         * method to put it in the buffer
         *
         * @param data floats that have been converted with {@link Float#floatToIntBits(float)}
         */
        public void Put(int[] data)
        {
            ByteBuffer byteBuffer = this.mByteBuffer;

            byteBuffer.Position(byteBuffer.Position() + GLHelper.BYTES_PER_FLOAT * data.Length);
            FloatBuffer floatBuffer = this.mFloatBuffer;

            floatBuffer.Position(floatBuffer.Position() + data.Length);
            this.mIntBuffer.Put(data, 0, data.Length);
        }
예제 #2
0
        /**
         * It's like {@link FloatBuffer#put(float[])}, but about 10 times faster
         */
        public void Put(float[] data)
        {
            int length = data.Length;

            int[] ia = sWeakIntArray.Get();
            if (ia == null || ia.Length < length)
            {
                ia            = new int[length];
                sWeakIntArray = new SoftReference <int[]>(ia);
            }

            for (int i = 0; i < length; i++)
            {
                ia[i] = Float.FloatToRawIntBits(data[i]);
            }

            ByteBuffer byteBuffer = this.mByteBuffer;

            byteBuffer.Position(byteBuffer.Position() + GLHelper.BYTES_PER_FLOAT * length);
            FloatBuffer floatBuffer = this.mFloatBuffer;

            floatBuffer.Position(floatBuffer.Position() + length);
            this.mIntBuffer.Put(ia, 0, length);
        }
예제 #3
0
        // ===========================================================
        // Constructors
        // ===========================================================

        /**
         * Constructs a new direct native-ordered buffer
         */
        public FastFloatBuffer(int pCapacity)
        {
            this.mByteBuffer  = ByteBuffer.AllocateDirect((pCapacity * GLHelper.BYTES_PER_FLOAT)).Order(ByteOrder.NativeOrder());
            this.mFloatBuffer = this.mByteBuffer.AsFloatBuffer();
            this.mIntBuffer   = this.mByteBuffer.AsIntBuffer();
        }
예제 #4
0
 public static void glVertexAttribPointer(int mPosHandle, int COORDS_PER_VERTEX, int p1, bool p2, int p3, Java.Nio.FloatBuffer mVertexBuffer)
 {
     GLES20ORIGINAL.GlVertexAttribPointer(mPosHandle, COORDS_PER_VERTEX, p1, p2, p3, mVertexBuffer);
 }