Search code examples
iphoneiosopencvopengl-esqcar-sdk

Application crash on glColor4f OpenGl function in IOS


I am working on OpenCV client app, my application works fine on IOS 5.1 but when i run my application on IOS 4.3 then it crashed at glColor4f function which defined in gl.h class, but it not show any error message on crash. I am doing like following:

QCAR::Matrix44F modelViewProjection;


                glColor4f(0.5f,0.0f,0.0f,0.0f);
                ShaderUtils::multiplyMatrix(&qUtils.projectionMatrix.data[0], &modelViewMatrix.data[0], &modelViewProjection.data[0]);
                glUseProgram(shaderProgramID);
                glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &vbVertices[0]);
                glEnableVertexAttribArray(vertexHandle);
                glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (GLfloat*)&modelViewProjection.data[0] );
                glColor4f(0.5f,0.0f,0.0f,0.0f);

                glEnableClientState (GL_VERTEX_ARRAY);
                glEnableClientState (GL_COLOR_ARRAY); 
                glEnableClientState(GL_COLOR_ARRAY);    
              //  glColorPointer(4, GL_FLOAT, 0, triangleColors);  
                glVertexPointer(3, GL_FLOAT, 0, (const GLvoid*) &vbVertices[0]); 
                glDisableClientState(GL_TEXTURE_COORD_ARRAY);
                glDisable(GL_TEXTURE_2D);
                glDrawArrays(GL_LINES, 0, 8);
                //glDisableClientState(GL_TEXTURE_COORD_ARRAY);
                //glDisable(GL_TEXTURE_2D);
                glDisableVertexAttribArray(vertexHandle);

Solution

  • I've done some research and here's a couple of things for you to try:

    Also, someone replied your question in this thread. He might be right.