相关疑难解决方法(0)

将GLKView嵌套到UIViewController中

我正在尝试在UIViewController中使用GLKView,我的代码看起来像这样

CustomViewController.h

#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>

@interface CustomViewController : UIViewController
{
    NSString * name;
}

@property NSString * name;
Run Code Online (Sandbox Code Playgroud)

CustomViewController.m

#import "CustomViewController.h"

@interface CustomViewController ()

@end

@implementation CustomViewController
@synthesize name;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    EAGLContext * context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
    CGRect mainScreen = [[UIScreen mainScreen] bounds];
    GLKView * …
Run Code Online (Sandbox Code Playgroud)

ios glkit

7
推荐指数
1
解决办法
8712
查看次数

嵌套的GLKView和GLKViewController

我是OpenGL ES的新手,我正在试验GLKit.我的目标是开发一个非常简单的应用程序,以获得对OpenGL的良好感觉.

我从Apple的示例代码(OpenGL ES游戏)开始,我实现了基本的手势控制:平移,缩放,旋转(轨迹球算法).

现在已经完成了,我想玩不同的投影矩阵,我开始设计一个用户界面来做到这一点:

http://tof.canardpc.com/view/7e0fc0da-9c63-489c-a1f1-eb6475dd3809.jpg

唯一的问题是当GLKViewController中的顶视图不是GLKView时它不起作用.

是否可以将GLKView作为子视图并仍然保留GLKViewController的酷炫功能?

谢谢.

objective-c ios glkit

4
推荐指数
1
解决办法
5072
查看次数

标签 统计

glkit ×2

ios ×2

objective-c ×1