void  GLEScmContext::drawPointsData(GLESFloatArrays& fArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices_in,bool isElemsDraw) {
    const GLfloat  *pointsArr =  NULL;
    int stride = 0; //steps in GLfloats

    //choosing the right points sizes array source
    if(m_pointsIndex >= 0) { //point size array was converted
        pointsArr=fArrs.arrays[m_pointsIndex];
        stride = 1;
    } else {
        GLESpointer* p = m_map[GL_POINT_SIZE_ARRAY_OES];
        pointsArr = static_cast<const GLfloat*>(isBindedBuffer(GL_ARRAY_BUFFER)?p->getBufferData():p->getArrayData());
        stride = p->getStride()?p->getStride()/sizeof(GLfloat):1;
    }

    //filling  arrays before sorting them
    PointSizeIndices  points;
    if(isElemsDraw) {
        for(int i=0; i< count; i++) {
            GLushort index = (type == GL_UNSIGNED_SHORT?
                    static_cast<const GLushort*>(indices_in)[i]:
                    static_cast<const GLubyte*>(indices_in)[i]);
            points[pointsArr[index*stride]].push_back(index);
        }
    } else {
        for(int i=0; i< count; i++) {
            points[pointsArr[first+i*stride]].push_back(i+first);
        }
    }
    drawPoints(&points);
}
Beispiel #2
0
void GLESv2Context::setupArraysPointers(GLESConversionArrays& cArrs,GLint first,GLsizei count,GLenum type,const GLvoid* indices,bool direct) {
    ArraysMap::iterator it;

    //going over all clients arrays Pointers
    for ( it=m_map.begin() ; it != m_map.end(); it++ ) {
        GLenum array_id   = (*it).first;
        GLESpointer* p = (*it).second;
        if(!isArrEnabled(array_id)) continue;

        unsigned int size = p->getSize();

        if(needConvert(cArrs,first,count,type,indices,direct,p,array_id)){
            //conversion has occured
            ArrayData currentArr = cArrs.getCurrentArray();
            setupArr(currentArr.data,array_id,currentArr.type,size,currentArr.stride, p->getNormalized());
            ++cArrs;
        } else {
            setupArr(p->getData(),array_id,p->getType(),
                     size,p->getStride(), p->getNormalized());
        }
    }
}