Example #1
0
 public DrawStream(int bufSize) {
   mVertBuf = DrawUtil.alloc(bufSize);
   // 12 is smallest possible vert size.
   // 6/4 is the max ration between indices and verts (for drawing quads)
   // 4 at the end is bytes per index.
   mIndBuf = DrawUtil.alloc(bufSize / 12 * 6 / 4 * 4);
 }
Example #2
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();
  }
Example #3
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();
 }