/** * Creates the vertex and normal buffers only. This is typically used for a * VertexAnimationObject3D's frames. * * @see VertexAnimationObject3D */ public void createVertexAndNormalBuffersOnly() { ((FloatBuffer) mBuffers.get(VERTEX_BUFFER_KEY).buffer).compact().position(0); ((FloatBuffer) mBuffers.get(NORMAL_BUFFER_KEY).buffer).compact().position(0); createBuffer(mBuffers.get(VERTEX_BUFFER_KEY), BufferType.FLOAT_BUFFER, GLES20.GL_ARRAY_BUFFER); createBuffer(mBuffers.get(NORMAL_BUFFER_KEY), BufferType.FLOAT_BUFFER, GLES20.GL_ARRAY_BUFFER); GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0); }
/** Starts the definition of a new cache, allowing the add and {@link #endCache()} methods to be called. */ public void beginCache () { if (drawing) throw new IllegalStateException("end must be called before beginCache"); if (currentCache != null) throw new IllegalStateException("endCache must be called before begin."); int verticesPerImage = mesh.getNumIndices() > 0 ? 4 : 6; currentCache = new Cache(caches.size, mesh.getVerticesBuffer().limit()); caches.add(currentCache); mesh.getVerticesBuffer().compact(); }
/** Starts the definition of a new cache, allowing the add and {@link #endCache()} methods to be called. */ public void beginCache () { if (drawing) throw new IllegalStateException("end must be called before beginCache"); if (currentCache != null) throw new IllegalStateException("endCache must be called before begin."); int verticesPerImage = mesh.getNumIndices() > 0 ? 4 : 6; currentCache = new Cache(caches.size, mesh.getVerticesBuffer().limit()); caches.add(currentCache); mesh.getVerticesBuffer().compact(); }
/** * Creates the actual Buffer objects. */ public void createBuffers() { for (BufferInfo info : mBuffers) { if (info.buffer != null) { if (info.buffer instanceof FloatBuffer) { ((FloatBuffer) info.buffer).compact().position(0); } else if (info.buffer instanceof IntBuffer) { ((IntBuffer) info.buffer).compact().position(0); } else if (info.buffer instanceof ShortBuffer) { ((ShortBuffer) info.buffer).compact().position(0); } else if (info.buffer instanceof ByteBuffer) { ((ByteBuffer) info.buffer).compact().position(0); } else if (info.buffer instanceof DoubleBuffer) { ((DoubleBuffer) info.buffer).compact().position(0); } else if (info.buffer instanceof LongBuffer) { ((LongBuffer) info.buffer).compact().position(0); } else if (info.buffer instanceof CharBuffer) { ((CharBuffer) info.buffer).compact().position(0); } } createBuffer(info); } GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0); mHaveCreatedBuffers = true; }
/** * Creates the vertex and normal buffers only. This is typically used for a * VertexAnimationObject3D's frames. * * @see VertexAnimationObject3D */ public void createVertexAndNormalBuffersOnly() { mVertices.compact().position(0); mNormals.compact().position(0); createBuffer(mVertexBufferInfo, BufferType.FLOAT_BUFFER, mVertices, GLES20.GL_ARRAY_BUFFER); createBuffer(mNormalBufferInfo, BufferType.FLOAT_BUFFER, mNormals, GLES20.GL_ARRAY_BUFFER); GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0); }
/** Starts the definition of a new cache, allowing the add and {@link #endCache()} methods to be called. */ public void beginCache () { if (drawing) throw new IllegalStateException("end must be called before beginCache"); if (currentCache != null) throw new IllegalStateException("endCache must be called before begin."); int verticesPerImage = mesh.getNumIndices() > 0 ? 4 : 6; currentCache = new Cache(caches.size, mesh.getVerticesBuffer().limit()); caches.add(currentCache); mesh.getVerticesBuffer().compact(); }
mVertices.compact().position(0); createBuffer(mVertexBufferInfo, BufferType.FLOAT_BUFFER, mVertices, GLES20.GL_ARRAY_BUFFER); mNormals.compact().position(0); createBuffer(mNormalBufferInfo, BufferType.FLOAT_BUFFER, mNormals, GLES20.GL_ARRAY_BUFFER); mTextureCoords.compact().position(0); createBuffer(mTexCoordBufferInfo, BufferType.FLOAT_BUFFER, mTextureCoords, GLES20.GL_ARRAY_BUFFER); mColors.compact().position(0); createBuffer(mColorBufferInfo, BufferType.FLOAT_BUFFER, mColors, GLES20.GL_ARRAY_BUFFER);