OpenGL|ES tutorials - Follows NeHe track.

Nibbie
Posts: 4
Joined: 2008.11
Post: #12
miketucker Wrote:One snag i ran into, I get an EXC_BAD_ACCESS error when i debug on the iphone. It runs fine in the simulator. and i dont get any compile errors.

I've got the same problem here. If I want to color the vertices I receive an EXC_BAD_ACCESS.

Code:
- (void)drawView:(GLView*)view {
    glClear(GL_COLOR_BUFFER_BIT);
    
    glLoadIdentity();            // Reset The Current Modelview Matrix
    glTranslatef(0.0f,2.0f,-6.0f);    // Move up 2 Units And Into The Screen 6.0
    
    glVertexPointer(3, GL_FLOAT, 0, triVertices);
    glEnableClientState(GL_VERTEX_ARRAY);
    
    glColorPointer(3, GL_UNSIGNED_BYTE, 0, triColors);
    glEnableClientState(GL_COLOR_ARRAY);
    
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
}

edit:
http://discussions.apple.com/thread.jspa...start=6135

I found that glColorPointer is the problem. The documentation says, that the size argument can be 3 or 4.
If I set it to 3 it doesn't work. 4 works great after you added a 4th value to the color array so that you've got 3 RGBA colors. If you want all colors full opaque, set it to 255. After that it works an your phone. At least on mine.
Quote this message in a reply
Post Reply 


Messages In This Thread
OpenGL|ES tutorials - Follows NeHe track. - Andy1988 - Nov 15, 2008 08:09 PM
Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Track down an autorelease bug kendric 2 3,052 Jun 28, 2009 05:09 AM
Last Post: kendric