Esempio n. 1
0
  private void begin(Writer writer, IndWriter indexer, int mode, int blockSize) {
    mDraw.checkErr();

    mActiveWriter = writer;
    mActiveIndexer = indexer;
    mActiveMode = mode;
    mVertBuf.clear();

    int bytes = mVertBuf.capacity();
    int vertBytes = writer.mVertWriter.bytesPerElem();
    mActiveCap = (bytes / (vertBytes * blockSize)) * blockSize;
    mActivePos = 0;

    writer.mProgram.bind(mDraw);
    writer.mVao.bind(mDraw);
    mVbo.bind(mDraw);

    if (indexer != null) {
      indexer.reset();
      mIndBuf.clear();
      mIbo.bind(mDraw);
    }

    DrawUtil.checkErr();
  }
Esempio n. 2
0
 public void end() {
   if (mActiveWriter == null) {
     return;
   }
   if (mActivePos > 0) {
     flush();
   }
   if (mActiveIndexer != null) {
     GLES30.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
     mActiveIndexer = null;
   }
   mActiveWriter.mVao.unbind(mDraw);
   mActiveWriter.mProgram.unbind(mDraw);
   DrawUtil.checkErr();
 }