Package java.nio

Examples of java.nio.FloatBuffer.rewind()


        if (colorBuf == null) {
            colorBuf = BufferUtils.createColorBuffer(_meshData.getVertexCount());
            _meshData.setColorBuffer(colorBuf);
        }

        colorBuf.rewind();
        for (int x = 0, cLength = colorBuf.remaining(); x < cLength; x += 4) {
            colorBuf.put(color.getRed());
            colorBuf.put(color.getGreen());
            colorBuf.put(color.getBlue());
            colorBuf.put(color.getAlpha());
View Full Code Here


        FloatBuffer colorBuf = _meshData.getColorBuffer();
        if (colorBuf == null) {
            colorBuf = BufferUtils.createColorBuffer(_meshData.getVertexCount());
            _meshData.setColorBuffer(colorBuf);
        } else {
            colorBuf.rewind();
        }

        for (int x = 0, cLength = colorBuf.limit(); x < cLength; x += 4) {
            colorBuf.put(MathUtils.nextRandomFloat());
            colorBuf.put(MathUtils.nextRandomFloat());
View Full Code Here

    gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
    gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, proj, 0);
    gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, model, 0);
    FloatBuffer fb = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    gl.glReadPixels(mouseX, height - mouseY, 1, 1, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, fb);
    fb.rewind();
    double[] mousePosArr = new double[4];
    glu.gluUnProject((double) mouseX, height - (double) mouseY, (double) fb.get(0), model, 0, proj, 0, viewport, 0,
        mousePosArr, 0);
    ((PGraphicsOpenGL) g).endGL();
    return new float[] { (float) mousePosArr[0], (float) mousePosArr[1], (float) mousePosArr[2] };
View Full Code Here

        array.setAll(FloatArray.unsafeValueOf());
        assertArrayEquals(new float[]{}, array.toArray(), 0);
        assertEquals(0, array.length());
        assertEquals(offset, array.offset());
        FloatBuffer buffer = array.buffer();
        buffer.rewind().limit(buffer.capacity());
        while (buffer.hasRemaining()) {
            assertEquals(0, buffer.get(), 0);
        }
    }
View Full Code Here

        }
        assertArrayEquals(new float[]{}, array.toArray(), 0);
        assertEquals(0, array.length());
        assertEquals(offset, array.offset());
        FloatBuffer buffer = array.buffer();
        buffer.rewind().limit(buffer.capacity());
        while (buffer.hasRemaining()) {
            assertEquals(0, buffer.get(), 0);
        }
    }
View Full Code Here

        array.clear();
        assertArrayEquals(new float[]{}, array.toArray(), 0);
        assertEquals(0, array.length());
        assertEquals(offset, array.offset());
        FloatBuffer buffer = array.buffer();
        buffer.rewind().limit(buffer.capacity());
        while (buffer.hasRemaining()) {
            assertEquals(0, buffer.get(), 0);
        }
    }
View Full Code Here

/* 181 */       this.bufferImpl = new ByteBufferWrapper(byteBuffer);
/* 182 */       break;
/*     */     case 7:
/* 184 */       FloatBuffer floatBuffer = ((FloatBuffer)buffer).asReadOnlyBuffer();
/*     */
/* 186 */       floatBuffer.rewind();
/* 187 */       this.bufferImpl = new FloatBufferWrapper(floatBuffer);
/* 188 */       break;
/*     */     case 8:
/* 190 */       DoubleBuffer doubleBuffer = ((DoubleBuffer)buffer).asReadOnlyBuffer();
/*     */
View Full Code Here

            }
        } else {
            if (gl.isGL2GL3()) {
                gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
            }
            vertexBuffer.rewind();
            if (gl.isGL2ES1()) {
                gl.getGL2ES1().glVertexPointer(vertexBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, vertexBuffer);
            }
        }
    }
View Full Code Here

            }
        } else {
            if (gl.isGL2GL3()) {
                gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
            }
            normalBuffer.rewind();
            if (gl.isGL2ES1()) {
                gl.getGL2ES1().glNormalPointer(GL.GL_FLOAT, 0, normalBuffer);
            }
        }
    }
View Full Code Here

            }
        } else {
            if (gl.isGL2GL3()) {
                gl.getGL2GL3().glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
            }
            colorBuffer.rewind();
            if (gl.isGL2ES1()) {
                gl.getGL2ES1().glColorPointer(colorBufferData.getValuesPerTuple(), GL.GL_FLOAT, 0, colorBuffer);
            }
        }
    }
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.