glColorPointer Size Must be 4

I did a bit more work on app #2 this weekend and I managed to get something working fine on the simulator, but it was all messed up when I actually tried it out on my iPhone. Turns out the problem was a call to glColorPointer(). There is a “size” parameter, which can normally be 1, 2, 3, or 4 depending on how many of the (r, g, b, a) channels you want to set. But for the iPhone OpenGL ES implementation, size must be 4. So, bear that in mind if you want to draw a vertex color poly mesh. You can’t just specify a color, you have to specify an alpha as well.

I probably would have gotten more done on my app if our friend hadn’t called us over for a game of Castle Crashers. I’m not addicted! I can quit anytime…

One Response to “glColorPointer Size Must be 4”

  1. Rydik Says:

    Thank you! I recently started working on an ES1renderer version of my app. I wasted so much time trying to figure out why I was getting bad memory access issues when enabling my color array (which happened to be just r g b). Anyway I added alpha and it did the trick. I also get this error on my simulator.