示例#1
0
void GeneralAttributeCheck::mapElements()
{
    if (!sGeneralAttCheckMutexRegistered)
    {
        if (!sGeneralAttCheckMutex)
        {
            XMLMutexLock lock(XMLPlatformUtils::fgAtomicMutex);

            if (!sGeneralAttCheckMutex)
                sGeneralAttCheckMutex = new XMLMutex(XMLPlatformUtils::fgMemoryManager);
        }

        // Use a faux scope to synchronize while we do this
        {
            XMLMutexLock lock(sGeneralAttCheckMutex);

            // If we got here first, then register it and set the registered flag
            if (!sGeneralAttCheckMutexRegistered)
            {
                // initialize
                setUpValidators();
                mapAttributes();

                // register for cleanup at Termination.
                sGeneralAttCheckCleanup.registerCleanup(GeneralAttributeCheck::reinitGeneralAttCheck);
                sGeneralAttCheckMutexRegistered = true;
            }
        }
    }
}
示例#2
0
void VertexBuffer::draw(Shader &shader, GLenum mode, int count)
{
    bind();
    mapAttributes(shader);
    enableVertexAttributes();
    glf->glDrawArrays(mode, 0, count ? count : _length);
    disableVertexAttributes();
    unbind();
}
示例#3
0
void VertexBuffer::drawIndexed(BufferObject &ibo, Shader &shader, GLenum mode, int count)
{
    bind();
    ibo.bind();
    mapAttributes(shader);
    enableVertexAttributes();
    glf->glDrawElements(mode, count ? count : ibo.size()/sizeof(uint32), GL_UNSIGNED_INT, nullptr);
    disableVertexAttributes();
    ibo.unbind();
    unbind();
}