• Acolyte of the Butterfly
    Acolyte of the Butterfly
    Posts: 105 from 2020/12/24
    @Bigfoot

    For VBO and texture mapping, well, try my infamous Doom3 port. ;)

    I complained about that before: TexGen functions fail totally even for some old opengl examples. I had to do a workaround in Doom3 for that among others.

    VBO "kinda works" but not with failures: Just right the level starts and having TGLDEBUG enabled you can catch a suspicious error about "disabling vbo support" of something like that.

    And reallocating new buffers locks up for seconds the game. Glitches and so on in game I don't know if they are related to vbo's or not.

    I compiled some examples using vbos and found some curious behaviour that differs from "standard way":

    Some raw example:

    Normal DrawArrays function (that works ok):

    Code:
    void drawVertexArray()
    {
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);

    // Set axes data
    glVertexPointer(nCoordsComponents, GL_FLOAT, 0, ave);
    glColorPointer(nColorComponents, GL_FLOAT, 0, ace);

    // Draw axes
    glDrawArrays(GL_LINES, 0, nLines*nVerticesPerLine);

    // Set pyramid data
    glVertexPointer(nCoordsComponents, GL_FLOAT, 0, pve);
    glColorPointer(nColorComponents, GL_FLOAT, 0, pce);

    // Draw pyramid
    glDrawArrays(GL_TRIANGLES, 0, nFaces*nVerticesPerFace);

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);
    }


    Now VBO way:

    Code:
    void drawVertexBufferObject()
    {
    vboIds = new GLuint[3];
    glGenBuffersARB(4,vboIds);

    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);

    // Set axes data
    glBindBufferARB(GL_ARRAY_BUFFER, vboIds[0]); // coordinates
    glBufferDataARB(GL_ARRAY_BUFFER, sizeof(ave), ave, GL_STATIC_DRAW);
    glVertexPointer(nCoordsComponents, GL_FLOAT, 0, 0);

    glBindBufferARB(GL_ARRAY_BUFFER, vboIds[1]); // color
    glBufferDataARB(GL_ARRAY_BUFFER, sizeof(ace), ace, GL_STATIC_DRAW);
    glColorPointer(nColorComponents, GL_FLOAT, 0, 0);

    // Draw axes
    glDrawArrays(GL_LINES, 0, nLines * nVerticesPerLine);


    // Set pyramid data
    glBindBufferARB(GL_ARRAY_BUFFER, vboIds[2]); // coordinates
    glBufferDataARB(GL_ARRAY_BUFFER, sizeof(pve), pve, GL_STATIC_DRAW);
    glVertexPointer(nCoordsComponents, GL_FLOAT, 0, 0);

    glBindBufferARB(GL_ARRAY_BUFFER, vboIds[3]); // color
    glBufferDataARB(GL_ARRAY_BUFFER, sizeof(pce), pce, GL_STATIC_DRAW);
    glColorPointer(nColorComponents, GL_FLOAT, 0, 0);

    // Draw pyramid
    glDrawArrays(GL_TRIANGLES, 0, nFaces * nVerticesPerFace);

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);

    // Disable the VBO
    glBindBufferARB(GL_ARRAY_BUFFER, 0);
    }


    VBO function doesn't draw the pyramid unless vertex and color states are disabled and enabled again after drawing "axes". Kinda not the way to work.


    So if Stencil is fixed, SDL2-GL/ScummVM/etc. should work OK. :)

    Documentation? Well besides differences from others opengl variations, a little more debugging output for those functions or some kind of "debug" driver outputing more information.

    By the way, the Warp3d debug error messages still hilarious. :)


    [ Edited by Cowcat 26.02.2022 - 07:33 ]
  • »25.02.22 - 20:03
    Profile