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

  • Home
  • SEARCH
  • 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 7984633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:20:16+00:00 2026-06-04T11:20:16+00:00

i try to set up an Xcode project based on the template OpenGL Game.

  • 0

i try to set up an Xcode project based on the template “OpenGL Game”.
That example has a StoryBoard with one GLKViewController and one GLKView.

I’d like to have:

  • one GLKView filling half the screen
  • one GLKView filling part of the other half
  • different things drawn in the two GLKViews

The problem:
– I can’t seem to put two GLKViews onto a screen when using a StoryBoard
– I can’t get GLKViews to work when using a NIB file

I wonder if any of the two ways is possible and what would be the best way to proceed.

Even when setting up just one GLKView and GLKViewController in a NIB file it seems that neither the method update: is called nor the glkView:drawInRect: of the GLKViewController.

How can i best place two GLKViews into an iPad app onto the same screen?

EDIT: Sorry for being imprecise.

Basically what i want to do:

  • I want to write an App that uses one screen
  • in one half of the screen i want one View in which i draw OpenGL
  • in one quarter i want another View in which i draw different OpenGL
  • in the rest there should be some buttons

I use Xcode 4.2 for iOS 5.1 for iPad

First approach, use a StoryBoard:

  • i can only place one large GLKView in which i draw OpenGL, no independent other GLKView
  • the example OpenGL code in that GLKView (using the GLKViewController) works fine though.

Second approach, delete the StoryBoard and create a NIB file:

  • i can place one GLKView into a Window, a GLKViewController-subclass next to it and link it to the GtkView, but there is nothing drawn in it
  • i can place a second GLKView into the window, a different GLKViewController-subclass next to it but there isn’t anything drawn in both GLKView.
  • i used the GLKView / GLKViewController example that worked fine in a StoryBoard.

Any way would be fine with me, at the moment none works.

Thanks for any hints,
Torsten.

SOLVED:
I use a NIB file now and i added a PRECONFIGURED combination of GLKViewController / GLKView.
Just placing a UIView and a UIViewController and then changing their type does not work.

  • 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-06-04T11:20:17+00:00Added an answer on June 4, 2026 at 11:20 am

    I ran into this same issue recently, but with only 2 GLKViews instead of 3.

    I ended up doing it all programmatically, since the storyboard method didn’t seem to be robust enough for this.

    What I did was create a “master” GLKViewController that would house all of my other GLKViews/GLKViewControllers.

    I then add child subclassed GLKViewControllers with their subsequent views.

    The tricky part that I found was that I needed to add the ViewControllers as a child as well as add their views as a child to the “master” view.

        GLKViewController master = [[GLKViewController alloc] initWithNibName:nil bundle:nil];
    
        GLKView *masterView = (GLKView *)master.view;
        masterView.context = context;
    
        master.view = masterView;
    
        /* I created a constructor with a parameter to identify dimensions and position for rendering  */
        GLKViewController *child1 = [[SubclassGLKViewController alloc] initWithNibName:nil bundle:nil];
    
        GLKView *child1View = (GLKView *)child1.view;
        child1View.context = context;
    
        child1.view = child1View;
    
        GLKViewController *child2 = [[SubclassGLKViewController alloc] initWithNibName:nil bundle:nil];
    
        GLKView *child2View = (GLKView *)child2.view;
        child2View.context = context;
    
        child2.view = child2View;    
    
        /*It seems all three of these steps are needed*/
        [master addChildViewController:child1];
        [child1 didMoveToParentViewController:master];
    
        [master.view addSubview:child1View];
    

    Another thing I had to do was implement viewDidAppear in my GLKViewController subclass.

    -(void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
    
        if(some condition is met)
          change frame size to something
        else 
          change frame size to something else
    
        self.view.frame = frame;
    }
    

    Hope this helps.

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

Sidebar

Related Questions

I have a problem when I try to set up Xcode . shown in
I have try to set icon for my App in the xCode. In the
my problem is that when i try to set the text of service1 and
Is there any way to set a preference in Xcode to show the project's
If I create a new iOS 5 project using one of XCode's templates and
try to set host in dsn of pdo like this: <?php /* Connect to
I try to set an attribute in a XML node using MSXML. IXMLDOMElement alone
I try to set up .hgrc file: [ui] username = MyName MySecondName <mymail@gmail.com> I
Every time try to set the value of any variable in my model object,
When I try and set the datatable width just the table main section is

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.