Example usage for javax.media.j3d J3DBuffer J3DBuffer

List of usage examples for javax.media.j3d J3DBuffer J3DBuffer

Introduction

In this page you can find the example usage for javax.media.j3d J3DBuffer J3DBuffer.

Prototype

public J3DBuffer(Buffer buffer) 

Source Link

Document

Constructs a J3DBuffer object and initializes it with the specified NIO buffer object.

Usage

From source file:GeometryByReferenceNIOBuffer.java

void createJ3DBuffers() {
    int i;/*from www  .  j ava 2s  . c  om*/
    ByteOrder order = ByteOrder.nativeOrder();

    FloatBuffer coord = ByteBuffer.allocateDirect(36 * 4).order(order).asFloatBuffer();
    coord.put(floatVerts, 0, 36);
    floatBufferCoord = new J3DBuffer(coord);

    FloatBuffer color = ByteBuffer.allocateDirect(36 * 4).order(order).asFloatBuffer();
    color.put(floatClrs, 0, 36);
    floatBufferColor = new J3DBuffer(color);

    FloatBuffer indexedCoord = ByteBuffer.allocateDirect(12 * 4).order(order).asFloatBuffer();
    indexedCoord.put(indexedFloatVerts, 0, 12);
    indexedFloatBufferCoord = new J3DBuffer(indexedCoord);

    FloatBuffer indexedColor = ByteBuffer.allocateDirect(12 * 4).order(order).asFloatBuffer();
    indexedColor.put(indexedFloatClrs, 0, 12);
    indexedFloatBufferColor = new J3DBuffer(indexedColor);
}

From source file:InterleavedNIOBuffer.java

void createInterleavedBuffers() {
    int size;//from w  w  w . j  av a  2s  . c o m
    ByteOrder order = ByteOrder.nativeOrder();

    size = (2 + 2 + 3 + 3) * 3 * 4;
    FloatBuffer vertex = ByteBuffer.allocateDirect(size * 4).order(order).asFloatBuffer();
    vertex.put(interleaved, 0, size);
    interleavedBuffer = new J3DBuffer(vertex);

    size = (2 + 2 + 3 + 3) * 4;
    FloatBuffer indexedVertex = ByteBuffer.allocateDirect(size * 4).order(order).asFloatBuffer();
    indexedVertex.put(indexedInterleaved, 0, size);
    indexedInterleavedBuffer = new J3DBuffer(indexedVertex);
}