Examples of asFloatBuffer()


Examples of java.nio.ByteBuffer.asFloatBuffer()

    }
    public void testFloatBufferGet() {
        final float MAGIC = 1234.5678f;
        Memory m = new Memory(8);
        ByteBuffer buf = m.getByteBuffer(0, m.size()).order(ByteOrder.nativeOrder());
        FloatBuffer fb = buf.asFloatBuffer();
        m.setFloat(0, MAGIC);
        assertEquals("Float not read from memory", MAGIC, fb.get(0), 0f);
    }
    public void testDoubleBufferGet() {
        final double MAGIC = 1234.5678;
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

        assertEquals("IntBuffer Pointer does not match",
                     p, Native.getDirectBufferPointer(b.asIntBuffer()));
        assertEquals("LongBuffer Pointer does not match",
                     p, Native.getDirectBufferPointer(b.asLongBuffer()));
        assertEquals("FloatBuffer Pointer does not match",
                     p, Native.getDirectBufferPointer(b.asFloatBuffer()));
        assertEquals("DoubleBuffer Pointer does not match",
                     p, Native.getDirectBufferPointer(b.asDoubleBuffer()));

        assertEquals("Wrong direct buffer address",
                     p, Native.getDirectBufferPointer(b));
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

          ByteArrayInputStream bis = new ByteArrayInputStream(buf.array());
          return bis;
        } else if (type.getName().equals(CAS.TYPE_NAME_FLOAT_ARRAY)) {
          arrayStart = getArrayStartAddress(fs.getAddress());
          buf = ByteBuffer.allocate(arraySize * 4);
          FloatBuffer floatbuf = buf.asFloatBuffer();
          float[] floatArray = new float[arraySize];
          for (int i = arrayStart; i < arrayStart + arraySize; i++) {
            floatArray[i - arrayStart] = Float.intBitsToFloat(this.getHeap().heap[i]);
          }
          floatbuf.put(floatArray);
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

      while ( ballIndex < ballCount ) {
        if ( animate ) {
          final ByteBuffer buffer = animVBO.map(batchSize * (2 * 4));

          long t0 = System.nanoTime();
          animate(transform, buffer.asFloatBuffer(), ballSize, ballIndex, batchSize, delta);
          long t1 = System.nanoTime();

          animateTime += t1 - t0;

          animVBO.unmap();
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

    renderer.setMVPUniform();

    ByteBuffer new_mapped_buffer = glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES, mapped_buffer);
    if ( new_mapped_buffer != mapped_buffer ) {
      mapped_buffer = new_mapped_buffer;
      mapped_float_buffer = new_mapped_buffer.asFloatBuffer();
    }

    new_mapped_buffer = glMapBufferOES(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY_OES, mapped_indices_buffer);
    if ( new_mapped_buffer != mapped_indices_buffer ) {
      mapped_indices_buffer = new_mapped_buffer;
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

   * updateVertex()/displaceVertex() methods.
   */
  public void beginUpdateVertices() {
    gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, vertCoordsVBO[0]);
    ByteBuffer temp = gl.glMapBufferARB(GL.GL_ARRAY_BUFFER_ARB, GL.GL_WRITE_ONLY);
    vertices = temp.asFloatBuffer();
  }

  /**
   * Disables vertex updating.
   */
 
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

 
   
  public void beginUpdateColors() {
    gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, colorsVBO[0]);
    ByteBuffer temp = gl.glMapBufferARB(GL.GL_ARRAY_BUFFER_ARB, GL.GL_WRITE_ONLY);
    colors = temp.asFloatBuffer();   
  }

  public void endUpdateColors() {
    if (tmpColorArray != null) {
      colors.put(tmpColorArray);
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

  }

  public void beginUpdateTexCoords(int n) {
    gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, texCoordsVBO[n]);
    ByteBuffer temp = gl.glMapBufferARB(GL.GL_ARRAY_BUFFER_ARB, GL.GL_WRITE_ONLY);
    texCoords = temp.asFloatBuffer();   
  }

  public void updateTexCoord(int idx, float s, float t) {
    if (tmpTexCoordsArray == null) {
      tmpTexCoordsArray = new float[2 * size];
 
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

  }

  public void beginUpdateNormals() {
    gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, normCoordsVBO[0]);
    ByteBuffer temp = gl.glMapBufferARB(GL.GL_ARRAY_BUFFER_ARB, GL.GL_WRITE_ONLY);
    normals = temp.asFloatBuffer();
  }

  public void endUpdateNormals() {
    if (tmpNormalsArray != null) {
      normals.put(tmpNormalsArray);
View Full Code Here

Examples of java.nio.ByteBuffer.asFloatBuffer()

  }

  public void beginUpdateAttributes(int n) {
    gl.glBindBufferARB(GL.GL_ARRAY_BUFFER_ARB, attribVBO[n]);
    ByteBuffer temp = gl.glMapBufferARB(GL.GL_ARRAY_BUFFER_ARB, GL.GL_WRITE_ONLY);
    attributes = temp.asFloatBuffer();
    curtAttrSize = attribSize[n];
  }

  public void endUpdateAttributes() {
    if (tmpAttributesArray != null) {
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.