Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 948843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:18:35+00:00 2026-05-15T23:18:35+00:00

I am developing an ipad app with openGL. In my app basically I am

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:18:36+00:00Added an answer on May 15, 2026 at 11:18 pm

    glColorPointer (as with most OpenGL calls) want plain C arrays, not Objective-C NSArray objects.

    struct RGBAColor {
        GLubyte r, g, b, a;
    };
    
    struct RGBAColor cubeFace1[16];
    for( int i = 0; i < 16; i++ ) {
        cubeFace1[i].r = 255;
        cubeFace1[i].g = 255;
        cubeFace1[i].b = 255;
        cubeFace1[i].a = 255;
    }
    glColorPointer( 4, GL_UNSIGNED_BYTE, 0, cubeFace1 );
    

    I highly recommend checking out the documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.