Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Application crash on glColor4f.

  1. #1
    Newbie Newbie
    Join Date
    Sep 2012
    Posts
    2

    Application crash on glColor4f.

    I am drawing a rectangular but on glColor4f app crash, and this happen only in ios4.3 devices not on iOS 5.1. I am stuck over here please help me on that. I am doing following code.

    QCAR::Matrix44F modelViewProjection;

    glColor4f(0.5f,0.0f,0.0f,0.0f);

    ShaderUtils::multiplyMatrix(&qUtils.projectionMatr ix.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);

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    This is an OpenGL ES issue, but I'm fairly sure that the ES versions that offer glVertexAttribPointer are not the same ones that offer glColor. Or, to put it another way, OpenGL ES 2.0 does not have glColor, glVertexPointer, and so forth. They're gone. Similarly, OpenGL ES 1.1 doesn't have glVertexAttribPointer, because it doesn't have shaders (and only shaders can use generic attributes).

    You've somehow mixed two different versions of OpenGL ES. You shouldn't do that.

  3. #3
    Newbie Newbie
    Join Date
    Sep 2012
    Posts
    2

    How to draw a rectangular using Opengl

    Quote Originally Posted by Alfonse Reinheart View Post
    This is an OpenGL ES issue, but I'm fairly sure that the ES versions that offer glVertexAttribPointer are not the same ones that offer glColor. Or, to put it another way, OpenGL ES 2.0 does not have glColor, glVertexPointer, and so forth. They're gone. Similarly, OpenGL ES 1.1 doesn't have glVertexAttribPointer, because it doesn't have shaders (and only shaders can use generic attributes).

    You've somehow mixed two different versions of OpenGL ES. You shouldn't do that.
    Thanks, So can you help me giving some code how to draw a rectangular using OPENGL1, and also OPENGL2.0. Thanks in Advance. Have a great day.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    OpenGL 2.0 is not the same thing as OpenGL ES 2.0. The ES is important.

    Also, ES 2.0 is not backwards-compatible with ES 1.1. So ES 2.0 code will not simply work in ES 1.1.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •