I've seen both EAGLView and GLKView used in iOS applications. What's the difference between them?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With