Hi guys
I am developing an ipad app with openGL. In my app basically I am drawing a basic shape i.e 3d cube, which can rotate according to user's finger motion. Now I am stuck on coloring part of this cube. I want user to choose surfaces of his choice to color this shape.
So what I am trying to do is...I am changing the array for glColorPointer() everytime when user change color. But cant got success in that. Here is the sample what I am trying to do
sample code :
const GLubyte *cubeFace1;
const GLubyte *cubeFace2;
NSMutableArray *cubeFace1Arr = [[NSMutableArray alloc] initWithCapacity:20 ];
for ( i = 0; i < 16; i++) {
// black color. value of '255' will change according to the user's selection of color
[cubeFace1Arr addObject: [NSNumber numberWithInt:255]];
}
NSMutableArray *cubeFace2Arr = [[NSMutableArray alloc] initWithCapacity:20 ];
for ( i = 0; i < 16; i++) {
// white color. value of '0' will change according to the user's selection of color
[cubeFace2Arr addObject: [NSNumber numberWithInt:0]];
}
cubeFace1 = cubeFace1Arr; // warning: assignment from incompatible pointer type
cubeFace1 = cubeFace2Arr; // warning: assignment from incompatible pointer type
glColorPointer(4, GL_UNSIGNED_BYTE, 0, cubeFace1);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, cubeFace2);
So, my basic problem is how I generate this color array dynamically? or how I remove this waring..!!
Thanks in advance and help appreciated.