Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've seen both EAGLView and GLKView used in iOS applications. What's the difference between them?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
684 views
Welcome To Ask or Share your Answers For Others

1 Answer

Both of these classes are related to OpenGL ES, but only one of them is actually supplied by Apple as part of the iOS SDK.

EAGLView is not a class provided with the Cocoa Touch frameworks. In Apple's OpenGL ES templates and sample code, they've created classes with this name that host OpenGL ES content. Others have copied and pasted these classes in the tutorials they've written about the subject. Generally, the one element all of the classes with this name have in common is that they override the +layerClass method to return [CAEAGLLayer class], indicating that these views will host OpenGL ES content within their backing layer.

GLKView is new in iOS 5.0 as part of the GLKit framework. GLKit aims to simplify some of the setup required for displaying OpenGL ES material by providing helper classes like GLKView. GLKView handles setup of framebuffers and render buffers for you, as well as some of the other tasks you normally have to write code for.

You might not see this class being used much in tutorials, given that many of them were written before iOS 5.0, but this is a handy helper class that can simplify iOS OpenGL ES rendering.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...