I keep reading how wonderfully easy it is to work with GLKit and your own custom shaders. But, so far, I have failed to find any information on how to actually do it. How can I take my own shader and "plug it in" into existing GLKit project?
Asked
Active
Viewed 2,824 times
5
-
From the blog Deli has linked, the solution seems to be as follows: First, you need the to create 2 files and add them to your project. I call them "fragment.glsl" and "vertex.glsl". Then, at the top of the Controller's .m file, add #define VERTEX_SHADER @"vertex" #define FRAGMENT_SHADER @"fragment" – Błażej Czapp Jul 05 '12 at 15:20
1 Answers
8
Well, you can look at this blog, which uses GLKit to build a basic OpenGL ES 2.0 application. There's also links to other blogs if you're looking to dig more into it:
GLKit + OpenGL ES 2.0 + iOS5 Programming blog
The only thing it doesn't cover is GLKBaseEffect, but if you want to build custom shaders like you said, you definitely don't want to use it anyway.
GLKit provides 4 basic things:
- A math library (Matrices, verctors...)
- A View/Controller combo made especially for drawing OpenGL content
- A texture loader class (GLKTextureLoader)
- GLKBaseEffect, which mimics OpenGL 1.0's fixed pipeline

Gabriel G. Roy
- 2,552
- 2
- 27
- 39
-
1*"1. A Matrix, Vector and Quaternion math library which uses NEON so is very high performance. 2. A View/View Controller combo made especially for drawing OpenGL ES content. 3. A texture loader class (GLKTextureLoader). 4. GLKBaseEffect, which mimics OpenGL ES 1.1's fixed pipeline."* This correction is a suggestions from an anonymous user which got rejected. Adding it as a comment here. – iDev Jan 16 '13 at 03:04