Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between GLKView and EAGLView?

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

like image 343
chetan rane Avatar asked Dec 07 '11 08:12

chetan rane


1 Answers

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.

like image 110
Brad Larson Avatar answered Oct 16 '22 19:10

Brad Larson