Package java.nio

Examples of java.nio.FloatBuffer.position()


                gl.glDrawElements(primType, count, GL.GL_UNSIGNED_INT, indicesBuffer);
                offset += count;
            }
        } else {
            IntBuffer buf = IntBuffer.wrap(indexCoord);
            buf.position(initialIndexIndex);
            switch (geo_type){
                case GeometryRetained.GEO_TYPE_INDEXED_QUAD_SET : gl.glDrawElements(GL2.GL_QUADS,     validIndexCount, GL.GL_UNSIGNED_INT, buf); break;
                case GeometryRetained.GEO_TYPE_INDEXED_TRI_SET  : gl.glDrawElements(GL.GL_TRIANGLES, validIndexCount, GL.GL_UNSIGNED_INT, buf); break;
                case GeometryRetained.GEO_TYPE_INDEXED_POINT_SET: gl.glDrawElements(GL.GL_POINTS,    validIndexCount, GL.GL_UNSIGNED_INT, buf); break;
                case GeometryRetained.GEO_TYPE_INDEXED_LINE_SET : gl.glDrawElements(GL.GL_LINES,     validIndexCount, GL.GL_UNSIGNED_INT, buf); break;
View Full Code Here


    if ((src.vertexType & TEXCOORD_DEFINED) != 0) {
        for (index=start; index < end; index++) {
      for (i = 0, tOffset = vOffset;
        i < texCoordSetCount; i++) {
          FloatBuffer texBuffer = (FloatBuffer)src.refTexCoordsBuffer[i].getROBuffer();
          texBuffer.position(src.indexTexCoord[i][index]*texCoordStride);
          texBuffer.get(vertexData, tOffset, texCoordStride);
          tOffset += texCoordStride;
      }
      vOffset += stride;
        }
View Full Code Here

    if ((src.vertexType & VATTR_DEFINED) == AF) {
        for (index=start; index < end; index++) {
      for (i = 0; i < vertexAttrCount; i++) {
                            int vaOffset = vOffset + vertexAttrOffsets[i];
          FloatBuffer vaBuffer = src.floatBufferRefVertexAttrs[i];
          vaBuffer.position(src.indexVertexAttr[i][index]*vertexAttrSizes[i]);
          vaBuffer.get(vertexData, vaOffset, vertexAttrSizes[i]);
      }
      vOffset += stride;
        }
    }
View Full Code Here

  public static void main(String[] args) {
    try { PServer v = null; //new PServer(4444);
    ByteBuffer b = ByteBuffer.allocate(20);
    FloatBuffer fb = b.asFloatBuffer();
    fb.put(0.1f); fb.flip();
    System.out.println(fb.position() + "=fpos   bpos=" + b.position());
    Thread t = new Thread(v);
    t.start();
    try {Thread.sleep(100); } catch (Exception e ) {}
    PServerClient psc = new PServerClient("localhost",4444);
    int[] e = {201, 202, 203, 1000000, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,2, 2,2,2,2,2,2,2,2,2,2,2,2,2};
View Full Code Here

                  public ResourceHolder<FloatBuffer> next()
                  {
                    final FloatBuffer retVal = myBuffer.asReadOnlyBuffer();

                    if (chunkFactor < myBuffer.remaining()) {
                      retVal.limit(retVal.position() + chunkFactor);
                    }
                    myBuffer.position(myBuffer.position() + retVal.remaining());

                    return StupidResourceHolder.create(retVal);
                  }
View Full Code Here

        // later.
        else {
            normBuf.put(0).put(0).put(1);
        }

        texBuf.position(i * 2);

        if (textureMode == TextureMode.Polar) {
            texBuf.put(0.5f).put(0.5f);
        } else {
            texBuf.put(0.5f).put(0.0f);
View Full Code Here

        if (varType != null && varType != VarType.Vector4Array)
            throw new IllegalArgumentException("Expected a "+varType.name()+" value!");

        FloatBuffer fb = (FloatBuffer) value;
        fb.position(index * 4);
        fb.put(x).put(y).put(z).put(w);
        fb.rewind();
        updateNeeded = true;
        setByCurrentMaterial = true;
    }
View Full Code Here

            int position = (buffer != null ? buffer.position() : 0);
            FloatBuffer newVerts = createFloatBuffer(position + required);
            if (buffer != null) {
                buffer.flip();
                newVerts.put(buffer);
                newVerts.position(position);
            }
            buffer = newVerts;
        }
        return buffer;
    }
View Full Code Here

                }
            }

            if (tcBuf != null){
                if (v0.vt != null){
                    tcBuf.position(v0.index * 2);
                    tcBuf.put(v0.vt.x).put(v0.vt.y);
                    tcBuf.position(v1.index * 2);
                    tcBuf.put(v1.vt.x).put(v1.vt.y);
                    tcBuf.position(v2.index * 2);
                    tcBuf.put(v2.vt.x).put(v2.vt.y);
View Full Code Here

            if (tcBuf != null){
                if (v0.vt != null){
                    tcBuf.position(v0.index * 2);
                    tcBuf.put(v0.vt.x).put(v0.vt.y);
                    tcBuf.position(v1.index * 2);
                    tcBuf.put(v1.vt.x).put(v1.vt.y);
                    tcBuf.position(v2.index * 2);
                    tcBuf.put(v2.vt.x).put(v2.vt.y);
                }
            }
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.