void Canvas::initPlayback(int multiSampleSamples) { m_bIsPlaying = true; m_pRootNode->connectDisplay(); m_MultiSampleSamples = multiSampleSamples; m_pVertexArray = VertexArrayPtr(new VertexArray(2000, 3000)); }
void DivNode::connectDisplay() { AreaNode::connectDisplay(); for (unsigned i = 0; i < getNumChildren(); ++i) { getChild(i)->connectDisplay(); } m_pClipVertexes = VertexArrayPtr(new VertexArray()); }
void DivNode::disconnect(bool bKill) { for (unsigned i = 0; i < getNumChildren(); ++i) { getChild(i)->disconnect(bKill); } if (m_pClipVertexes) { m_pClipVertexes = VertexArrayPtr(); } AreaNode::disconnect(bKill); }
void Canvas::stopPlayback(bool bIsAbort) { if (m_bIsPlaying) { if (!bIsAbort) { m_PlaybackEndSignal.emit(); } m_pRootNode->disconnect(true); m_pRootNode = CanvasNodePtr(); m_IDMap.clear(); m_bIsPlaying = false; m_pVertexArray = VertexArrayPtr(); } }
VertexArrayPtr RenderContext::createVertexArray(VertexDescription description, VertexBufferPtr buffer) { VertexArrayPtr vao = VertexArrayPtr(new VertexArray()); vao->bind(); buffer->bind(); int offset = 0; for(VertexDescriptionElement e : description) { if(e.shaderAttribLocation() != -1) { glVertexAttribPointer(e.shaderAttribLocation(), e.numberOfComponents(), (int)e.type(), GL_FALSE, description.sizeInBytes(), (char*)nullptr + offset); glEnableVertexAttribArray(e.shaderAttribLocation()); } offset += e.sizeInBytes(); } buffer->release(); vao->release(); return vao; }