Application crashes

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);

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.

glVertexAttribPointer(m_distLocation, 0, GL_FLOAT, GL_FALSE, 0, 0);

Looks like you are giving OpenGL a null pointer to read attribute data from.

Generally the first thing I often do when something crashes is to run under a debugger to get the exact location where it crashes and then look at variables at/near that position to see if there is anything suspicious - it does not always find the problem, but works for the easy cases :wink: