PDA

View Full Version : Adding components to EAGLView in GLES project




tonyw
May 13, 2009, 12:45 PM
hi,

been playing about with open gl es project, as created by xcode New Project... now confused! From the program code, if I add simple components, such as UILabel, to the EAGLView *glView object via addSubview, then they do not appear. However, booting into the Interface Builder and double clicking the Window object brings up a view of type EAGLView. Dragging a UILable onto this results in the label appearing atop of the GL window at runtime.

I'm wondering how to do the equivalent of Interface Builder drag n drop programatically? I thought I had it, but evidently not!

any thoughts?

thanks
tony



xsmasher
May 15, 2009, 02:31 AM
I wonder if adding the objects in UIBuilder is making them subviews of the window, not the EAGLView? The draw methods for the EAGLView might lack the [super drawView] or [super drawRect:] calls that would caused subviews to be drawn.

EITHER WAY, the docs warn you not to put UIviews on top of an EAGLView - performance goes into the crapper.

tonyw
May 15, 2009, 05:23 AM
thanks xsmasher - good points. Presumably, it's perfectly reasonable to add UIViewControllers to the window after releasing the EAGLView and generally switch between the two as required?