Package java.nio

Examples of java.nio.Buffer.limit()


    // limit can't be larger than capacity
    buf = factory.newInstance();
    try
      {
        buf.limit(21);
        h.check(false, "limit: is larger than capacity");
      }
      catch(IllegalArgumentException iae)
      {
        h.check(true, "limit: can't be larger than capacity");
View Full Code Here


    buf = factory.newInstance();
    buf.position(5);
    buf.mark();
    buf.position(6);
    buf.limit(9);
    h.check(buf.rewind(), buf, "rewind: buf.rewind()");
    checkStatus(h, buf, "rewind", 20, 9, true, 9, 0);
    try
      {
        buf.reset();
View Full Code Here

    buf = factory.newInstance();
    buf.position(5);
    buf.mark();
    buf.position(6);
    buf.limit(7);
    h.check(buf.clear(), buf, "clear: buf.clear()");
    checkStatus(h, buf, "clear", 20, 20, true, 20, 0);
    try
      {
        buf.reset();
View Full Code Here

            /**
             * instance Sf3Texture with the filled up pixelBuffer
             */
            texture = new Sf3Texture(hashCode, pixelBuffer, textureSize.width, textureSize.height, bands, imageSize, transferMode);
            if (JXAenvUtils._debug) {
                System.err.println("new Sf3Texture buffer " + BufferIO._getBufferDataTypeName(pixelBuffer) + " size : " + BufferIO._countByteSize(pixelBuffer) + " w/ " + bands + " bands is POT ? : " + (isPOT((float) pixelBuffer.limit() / (float) bands) ? "yes" : "no"));
            }
        } else {
            throw new JXAException("pixel buffer is null, no data could be loaded");
        }
        if (flushSp) {
View Full Code Here

                            FloatBuffer cloneBindPosePosition = clone.getFloatBuffer(Type.BindPosePosition);
                            FloatBuffer cloneNormals = clone.getFloatBuffer(Type.Normal);
                            FloatBuffer cloneBindPoseNormals = clone.getFloatBuffer(Type.BindPoseNormal);
                            Buffer cloneIndexes = clone.getBuffer(Type.Index).getData();

                            for (int i = 0; i < cloneIndexes.limit(); ++i) {
                                int index = cloneIndexes instanceof ShortBuffer ? ((ShortBuffer) cloneIndexes).get(i) : ((IntBuffer) cloneIndexes).get(i);
                                if (!modifiedIndexes.contains(index)) {
                                    modifiedIndexes.add(index);

                                    this.get(clonePosition, index, point);
View Full Code Here

                            switch (mesh.getMode()) {
                                case Points:
                                    cloneIndexes.flip();
                                    break;
                                case Lines:
                                    for (int i = 0; i < cloneIndexes.limit(); i += 2) {
                                        if (cloneIndexes instanceof ShortBuffer) {
                                            short index = ((ShortBuffer) cloneIndexes).get(i + 1);
                                            ((ShortBuffer) cloneIndexes).put(i + 1, ((ShortBuffer) cloneIndexes).get(i));
                                            ((ShortBuffer) cloneIndexes).put(i, index);
                                        } else {
View Full Code Here

                                            ((IntBuffer) cloneIndexes).put(i, index);
                                        }
                                    }
                                    break;
                                case Triangles:
                                    for (int i = 0; i < cloneIndexes.limit(); i += 3) {
                                        if (cloneIndexes instanceof ShortBuffer) {
                                            short index = ((ShortBuffer) cloneIndexes).get(i + 2);
                                            ((ShortBuffer) cloneIndexes).put(i + 2, ((ShortBuffer) cloneIndexes).get(i + 1));
                                            ((ShortBuffer) cloneIndexes).put(i + 1, index);
                                        } else {
View Full Code Here

            }

            if (geometry.getMesh().getMode() == Mode.Triangles) {// there is no need to flip the indexes for lines and points
                LOGGER.finer("Flipping index order in triangle mesh.");
                Buffer indexBuffer = geometry.getMesh().getBuffer(Type.Index).getData();
                for (int i = 0; i < indexBuffer.limit(); i += 3) {
                    if (indexBuffer instanceof ShortBuffer) {
                        short index = ((ShortBuffer) indexBuffer).get(i + 1);
                        ((ShortBuffer) indexBuffer).put(i + 1, ((ShortBuffer) indexBuffer).get(i + 2));
                        ((ShortBuffer) indexBuffer).put(i + 2, index);
                    } else {
View Full Code Here

            vboID = makeVBOId();
            data.setVBOID(context.getGlContextRep(), vboID);

            rendRecord.invalidateVBO();
            JoglRendererUtil.setBoundVBO(rendRecord, vboID);
            gl.glBufferData(GL.GL_ARRAY_BUFFER, dataBuffer.limit() * data.getByteCount(), dataBuffer,
                    getGLVBOAccessMode(data.getVboAccessMode()));
        } else {
            throw new Ardor3dException("Attempting to create a vbo id for an AbstractBufferData with no Buffer value.");
        }
        return vboID;
View Full Code Here

        if (data.isNeedsRefresh()) {
            final GL gl = GLContext.getCurrentGL();
            final Buffer dataBuffer = data.getBuffer();
            dataBuffer.rewind();
            JoglRendererUtil.setBoundVBO(rendRecord, vboID);
            gl.glBufferSubData(GL.GL_ARRAY_BUFFER, offsetBytes, dataBuffer.limit() * data.getByteCount(), dataBuffer);
            data.setNeedsRefresh(false);
        }
    }

    private int setupIndicesVBO(final IndexBufferData<?> data, final RenderContext context,
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.