Ok completely OpenGL-ES noob question. If anyone could explain how apple does GLPaint or better yet the VERY BASIC code of how they accomplished that, I would be thrilled. I开发者_如何学JAVA am honestly not trying to ask for you to write my program, but trying to understand the basics of how apple accomplished the GLPaint drawing feature.
P.S: I don't need the color conversion, just the drawing (obviously)
Please helpI don't know why someone would produce simpler code than that which already exists for the Apple GLPaint example, yet does the same thing. The analysis that Kenny points to is interesting, if a little odd. I don't know if a line-by-line analysis of this example is the best way to learn what it does.
When working with OpenGL ES on the iPhone, you need to do your drawing in a particular type of Core Animation layer, a CAEAGLLayer, which is hosted inside of a UIView. The EAGLView class in that example contains boilerplate code for setting up such a layer-hosting view.
The view where the actual drawing is performed is the PaintingView, a subclass of EAGLView. The PaintingView handles touch events, and incrementally draws a brush texture every so many pixels along the line drawn by your finger. When the screen needs to be erased, the OpenGL ES context is cleared.
If it's the basic OpenGL ES setup that has you stumped, I'd recommend creating a new project based on the OpenGL ES Application template in Xcode and seeing how that very simple starting application works.
精彩评论