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);
glEnableVertexAttribPointer(m_posAttr);
glEnableVertexAttribArray(m_distLocation);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);
This is similar as one of questions before, but I don’t understand what is wrong here.