Drawing object without VBO

I am trying to send data to GPU without using VBOs. When I do so my application crashes. I am using OpenGL ES 2.0 and Qt development tools. The code is given below. I think the problem is in sending attribute variables m_posAttr and m_distLocation.

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

    int      posAttrSize           = sizeof(float) * 2;
    GLintptr posAttrStart          = reinterpret_cast<GLintptr>(&vertices[0]);

    int      stride                = posAttrSize;

    glVertexAttribPointer(m_posAttr,      2, GL_FLOAT, GL_FALSE, stride, reinterpret_cast<GLvoid*>(posAttrStart));
    glVertexAttribPointer(m_distLocation, 0, GL_FLOAT, GL_FALSE, 0, 0);

    glBindAttribLocation(m_programID, m_posAttr, "posAttr" );
    glBindAttribLocation(m_programID, m_distLocation, "distance" );

    glUniform1i(m_patternLocation, -1);
    glUniform4fv(m_colorAttr, 1, vColor);
    glUniform1f(m_depthAttr, z);
    glUniform1f(m_zoom, _zoom / 100);
    glUniform2fv(m_scale, 1, _scale);
    glUniform2fv(m_translate, 1, _trans);
    glUniform1f(m_theta, _theta);

    glDrawArrays(et, offsetInBytesFill, nVerticesFill );

Please help…

There are 2 strange things. First you are setting the attrib pointer for m_distLocation to read from 0. Second an unknown variable “et” is being passed as the mode parameter of glDrawArrays. The problem is most likely the first item.

Use of VBOs is recommended for performance. Indeed use of client-side arrays is deprecated. They are only in OpenGL ES 3.0 for backward compatibility.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.