OpenGL 学习笔记(1)

来源:互联网 发布:ipad 软件 编辑:程序博客网 时间:2024/05/16 07:42

本文仅是学习中遇到问题的整理,可能说得非常不详细,如果有问题,请指正。


XCode5中创建OpenGL ES 2.0的例子时,按照下面的方法。出现无法显示黑屏的现象。

http://www.cnblogs.com/creolophus/archive/2013/05/21/3090139.html

使用XCode4的windows-base模板创建新工程时,可以正常显示。

XCode4 windows-base template

http://forums.bignerdranch.com/viewtopic.php?f=73&t=3336


原因找到了,

XCode5的时候,Storyboard生成的View在OpenGL View的上面,将其覆盖。如果试着晚一点生成OpenGL View则不会出现这个问题。

XCode5时,可以使用Empty Application模板,这样创建时,需要在 AppDelegate的application didFinishLaunchingWithOption中先生成self.window

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{    // Override point for customization after application launch.    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];    self.window.backgroundColor = [UIColor whiteColor];    // At top of application:didFinishLaunchingWithOptions    CGRect screenBounds = [[UIScreen mainScreen] bounds];    self.glView = [[OpenGLView alloc] initWithFrame:screenBounds];    [self.window addSubview:_glView];        [self.window makeKeyAndVisible];    return YES;}

一篇很好的例子: 第2部分讲解的是Texture,还没有阅读。

http://www.raywenderlich.com/3664/opengl-tutorial-for-ios-opengl-es-2-0

http://www.raywenderlich.com/4404/opengl-es-2-0-for-iphone-tutorial-part-2-textures 

The common mistakes 

http://www.opengl.org/wiki/Common_Mistakes


1, glLoadIdentity 

坐标系复位,当前矩阵变为单位矩阵。


0 0
原创粉丝点击