Problem with using glDrawElementsBaseVertex - bad draws

Hey
[STRIKE]Before I get on with my problem, does any1 know how to change this forum from that weird “round” style - mobile like to a normal desktop like? I tried searching for the answer, it but I cant because the catch check is under a search button and I can’t get it to work at all! the hell o.O[/STRIKE] went with opera, now it works. Chrome is broken o.O
Anyway, I’m trying to optimize my render a little, with some glDrawElementsBaseVertex to help with frame rate.

This is my rough loop that I use for the render :

    int x = 0;
    for (auto &geo:mNodeList) { << geometry array
        mShader->setUniformValue("mvp_matrix", matrix *  geo->mAbsoluteMatrix); << set matrix for next node ( kinda wonder how could I pass an array of matrices so that I can do it all in 1 call one day... anyway issue for another day)
        glDrawElementsBaseVertex(GL_TRIANGLES, mMeshesCountList[x], GL_UNSIGNED_INT, (const GLvoid *) (skip * sizeof(indices.first())), skip);<< this is broken, it generated "broken" meshes. I tried a number of different things. Cant get it to run at all : -(
        skip += mMeshesCountList[x];
        ++x;
    }

Anyway

So I’m trying to render 10k objects-geometries. Just simple draw for testing.
QVector mMeshesCountList - bad naming but what it is a indices count that needs drawing per object [x]
skip = the offset to next mesh in indices;
I also tried this lately :

 glDrawElementsBaseVertex(GL_TRIANGLES, mMeshesCountList[x], GL_UNSIGNED_INT,(const void*) (skip * sizeof(unsigned int), skip);

I’m struggling to wrap my head around it, it must be somehow very basic issue because there is almost no tutorials/info on it on the net and “The official guide to learning opengl 4.3” has also very little code with examples for it. I mean… suhhhh

So what did I do wrong here if I may ?

[QUOTE=Dariusz;1293437]Hey
Before I get on with my problem, does any1 know how to change this forum from that weird “round” style - mobile like to a normal desktop like?[/quote]

Can’t you just have your mobile browser display the site in desktop mode?

Well, it’s kind of hard to say one way or the other, since the correctness or incorrectness of your code is based on your actual data. Which you haven’t shown.

[QUOTE=Alfonse Reinheart;1293438]Can’t you just have your mobile browser display the site in desktop mode?
Im on desktop chrome… I dont know how to tell this forum to run in desktop mode on my dekstop system o.O

Well, it’s kind of hard to say one way or the other, since the correctness or incorrectness of your code is based on your actual data. Which you haven’t shown.[/QUOTE]
Oh hmmm

Well I have something like this for data : (how can I add

 to it? 


    /// Gather the size of each vector and create infices list
    std::shared_ptr&lt;geometryObj&gt; geo;
    QVector&lt;unsigned int&gt;mMeshesCountList(listSize);
    for (int x = 0; x &lt; listSize; ++x) {
        geo = mNodeList[x]-&gt;getGeometryPtr();
        verteSize += geo-&gt;mVertexCount;
        normalsSize += geo-&gt;mNormalsCount;
        indicesSize += geo-&gt;mIndicesCount;
        mMeshesCountList[x] = geo-&gt;mIndicesCount;
    }
    /// create vectors
    QVector&lt;QVector3D&gt; mVertex(verteSize);
    QVector&lt;QVector3D&gt; mNormals(normalsSize);
    mIndices.resize(indicesSize);
    unsigned long long int offsetVert = 0;
    unsigned long long int offsetNormal = 0;
    offsetIndice = 0;
    /// Gather data for each vector
    for (auto &node:mNodeList) {
        geo = node-&gt;getGeometryPtr();
        for (int x = 0; x &lt; geo-&gt;mVertexCount; ++x) {
            mVertex[offsetVert] = geo-&gt;mVertex[x];
            ++offsetVert;
        }
        for (int x = 0; x &lt; geo-&gt;mNormalsCount; ++x) {
            mNormals[offsetNormal] = geo-&gt;mVertexNormal[x];
            ++offsetNormal;
        }
        for (int x = 0; x &lt; geo-&gt;mIndicesCount; ++x) {
            mIndices[offsetIndice] = geo-&gt;mIndices[x];
            ++offsetIndice;
        }
    }

    /// allocate data
    mVao-&gt;bind();

    mBufferVertex-&gt;bind();
    mBufferVertex-&gt;allocate(mVertex.get(), verteSize * sizeof(QVector3D));
    mBufferVertex-&gt;release();
    
    mBufferNormals-&gt;bind();
    mBufferNormals-&gt;allocate(mNormals.get(), normalsSize * sizeof(QVector3D));
    mBufferNormals-&gt;release();

    mBufferIndices-&gt;bind();
    mBufferIndices-&gt;allocate(mIndices.data(), indicesSize * sizeof(unsigned int));
    mBufferIndices-&gt;release();

Im on desktop chrome… I dont know how to tell this forum to run in desktop mode on my dekstop system o.O - ok I’ve opened it in opera. Opera works. wow O_O

[QUOTE=Alfonse Reinheart;1293438]
Well, it’s kind of hard to say one way or the other, since the correctness or incorrectness of your code is based on your actual data. Which you haven’t shown.[/QUOTE]
Oh hmmm

Well I have something like this for data :


    /// Gather the size of each vector and create indices list
    std::shared_ptr<geometryObj> geo;
    QVector<unsigned int>mMeshesCountList(listSize);
    for (int x = 0; x < listSize; ++x) {
        geo = mNodeList[x]->getGeometryPtr();
        verteSize += geo->mVertexCount;
        normalsSize += geo->mNormalsCount;
        indicesSize += geo->mIndicesCount;
        mMeshesCountList[x] = geo->mIndicesCount;
    }
    /// create vectors
    QVector<QVector3D> mVertex(verteSize);
    QVector<QVector3D> mNormals(normalsSize);
    mIndices.resize(indicesSize);
    unsigned long long int offsetVert = 0;
    unsigned long long int offsetNormal = 0;
    offsetIndice = 0;
    /// Gather data for each vector
    for (auto &node:mNodeList) {
        geo = node->getGeometryPtr();
        for (int x = 0; x < geo->mVertexCount; ++x) {
            mVertex[offsetVert] = geo->mVertex[x];
            ++offsetVert;
        }
        for (int x = 0; x < geo->mNormalsCount; ++x) {
            mNormals[offsetNormal] = geo->mVertexNormal[x];
            ++offsetNormal;
        }
        for (int x = 0; x < geo->mIndicesCount; ++x) {
            mIndices[offsetIndice] = geo->mIndices[x];
            ++offsetIndice;
        }
    }

    /// allocate data
    mVao->bind();

    mBufferVertex->bind();
    mBufferVertex->allocate(mVertex.get(), verteSize * sizeof(QVector3D));
    mBufferVertex->release();
    
    mBufferNormals->bind();
    mBufferNormals->allocate(mNormals.get(), normalsSize * sizeof(QVector3D));
    mBufferNormals->release();

    mBufferIndices->bind();
    mBufferIndices->allocate(mIndices.data(), indicesSize * sizeof(unsigned int));
    mBufferIndices->release();

I’m using QT openGL…

also the render code before loop is this :


    mShader->bind();
    mVao->bind();
    mBufferVertex->bind();
    mBufferIndices->bind();
    bindPosition();// enableAttr/setAttr
    mBufferNormals->bind();
    bindColor();// enableAttr/setAttr