Package java.nio

Examples of java.nio.DoubleBuffer.position()


  }

  private static DoubleBuffer doNoCopyWrap(DoubleBuffer buffer) {
    DoubleBuffer direct_buffer = lookupBuffer(buffer);
    direct_buffer.limit(buffer.limit());
    direct_buffer.position(buffer.position());
    return direct_buffer;
  }

  private static ByteBuffer lookupBuffer(ByteBuffer buffer) {
    return getCachedBuffers(buffer.remaining()).byte_buffer;
View Full Code Here


                        fb.put((float)vv[i+offset]);
                    }
                    break;
                case CV_64F:
                    DoubleBuffer db = getDoubleBuffer();
                    db.position(index);
                    db.put(vv, offset, length);
                    break;
                default: assert(false);
            }
        }
View Full Code Here

        for(int row=0; row<hcore.vertexcount/hcore.stripsize; row++) {
          gl.glActiveTexture(GL.GL_TEXTURE0);
          gl.glClientActiveTexture(GL.GL_TEXTURE0);
         
          DoubleBuffer db = hcore.getVertexDb();
          db.position(vertex_i*3);
          gl.glVertexPointer(3, GL.GL_DOUBLE, 0, db);
          gl.glNormalPointer(GL.GL_DOUBLE, 0, db);
         
          DoubleBuffer texDb = hcore.getTexDb();
          texDb.position(texcoord_i*2);
 
View Full Code Here

          db.position(vertex_i*3);
          gl.glVertexPointer(3, GL.GL_DOUBLE, 0, db);
          gl.glNormalPointer(GL.GL_DOUBLE, 0, db);
         
          DoubleBuffer texDb = hcore.getTexDb();
          texDb.position(texcoord_i*2);
          gl.glTexCoordPointer(2, GL.GL_DOUBLE, 0, texDb);

          // TODO can be removed when texture blending is not used
          gl.glActiveTexture(GL.GL_TEXTURE1);
          gl.glClientActiveTexture(GL.GL_TEXTURE1);
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray0() throws Exception {
        DoubleBuffer buffer = ByteBuffer.allocateDirect(Double.SIZE / Byte.SIZE * 10).asDoubleBuffer();
        buffer.position(1).limit(9);
        BoundedDoubleArray notBackedByArray = BoundedDoubleArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(DoubleArray.unsafeValueOf());
        assertEquals(8, notBackedByArray.length());
        assertArrayEquals(new double[]{1, 1, 2, 1, 2, 3, 3, 4}, notBackedByArray.toArray(), 0);
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray1() throws Exception {
        DoubleBuffer buffer = ByteBuffer.allocateDirect(Double.SIZE / Byte.SIZE * 11).asDoubleBuffer();
        buffer.position(1).limit(9);
        BoundedDoubleArray notBackedByArray = BoundedDoubleArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(DoubleArray.unsafeValueOf(5));
        assertEquals(9, notBackedByArray.length());
        assertArrayEquals(new double[]{1, 1, 2, 1, 2, 3, 3, 4, 5}, notBackedByArray.toArray(), 0);
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray2() throws Exception {
        DoubleBuffer buffer = ByteBuffer.allocateDirect(Double.SIZE / Byte.SIZE * 11).asDoubleBuffer();
        buffer.position(1).limit(9);
        BoundedDoubleArray notBackedByArray = BoundedDoubleArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(DoubleArray.unsafeValueOf(5, 5));
        assertEquals(10, notBackedByArray.length());
        assertArrayEquals(new double[]{1, 1, 2, 1, 2, 3, 3, 4, 5, 5}, notBackedByArray.toArray(), 0);
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray3() throws Exception {
        DoubleBuffer buffer = ByteBuffer.allocateDirect(Double.SIZE / Byte.SIZE * 11).asDoubleBuffer();
        buffer.position(1).limit(9);
        BoundedDoubleArray notBackedByArray = BoundedDoubleArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        try {
            notBackedByArray.addAll(DoubleArray.unsafeValueOf(5, 5, 5));
            fail();
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray0() throws Exception {
        DoubleBuffer buffer = ByteBuffer.allocateDirect(Double.SIZE / Byte.SIZE * 10).asDoubleBuffer();
        buffer.position(1).limit(9);
        BoundedDoubleArray notBackedByArray = BoundedDoubleArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(DoubleArray.unsafeValueOf());
        assertEquals(8, notBackedByArray.length());
        assertArrayEquals(new double[]{1, 1, 2, 1, 2, 3, 3, 4}, notBackedByArray.toArray(), 0);
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray1() throws Exception {
        DoubleBuffer buffer = ByteBuffer.allocateDirect(Double.SIZE / Byte.SIZE * 11).asDoubleBuffer();
        buffer.position(1).limit(9);
        BoundedDoubleArray notBackedByArray = BoundedDoubleArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(DoubleArray.unsafeValueOf((double) 5));
        assertEquals(9, notBackedByArray.length());
        assertArrayEquals(new double[]{1, 1, 2, 1, 2, 3, 3, 4, 5}, notBackedByArray.toArray(), 0);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.