OpenGL ES - Where is EAGLView.h? xcode 4 - iphone

Hello I'm very new to OpenGlES and i have started to try to learn it with online tutorials... but in each tutorial they ask me to create a OpenGL ES Xcode project, and then edit EAGLView.h. But I can't find it. Is it just me or has Xcode 4 changed its location etc. Also, when I run the application it gives me two cubes... 1 red and 1 blue... spinning around. In some tutorials, there is simply a multicoloured box, not in 3 dimensions. Is it possible to go back to that?
Thanks

The sample application has changed significantly since the tutorials you are reading was written.
EAGLView, in its many incarnations, provided a UIView subclass that connected OpenGL to UIKit. As of iOS 5 there's no need for a custom class because of the introduction of GLKit. The modern OpenGL sample simply uses a GLKView, which is a built-in UIView subclass connecting OpenGL to UIKit.
What the sample actually shows has also changed to highlight the vector manipulation parts of GLKit that provide everything GL ES 1.1 supplied but which was cut from ES 2.0, and more.
If you want to work up from a tutorial, you're probably going to have to find a newer one. Searching for GLKit tutorials directly is probably the best idea — this one (amongst many others) looked like it covers mostly the modern stuff, for the sake of saying something rather than nothing.

Instead of EAGLView.h and m, they have moved all of the code into files named viewController.h and m.
If you have truly generated an "OpenGL Game" project as they are calling it in the newer versions of XCode!
In terms of the OpenGL code implemented to show the red and blue boxes etc... They have changed there sample code, you can from the m file put whatever you want there!!!

You can download sample code from here and work from that:
http://developer.apple.com/library/ios/#samplecode/GLES2Sample/Introduction/Intro.html

Related

Using 3D objects in an iOS app

How would I go about adding a 3D object from Maya into an iOS app? For now, before it gets too complicated, I just want to add it in, no response to touch yet. Is there a tutorial about this? Thanks!
Edit: It doesn't necessarily have to be Maya. I can learn how to use another program.
Molecules is a great open source iOS app that uses OpenGL ES to render 3D objects that have nice touch interaction. Maybe that would be a good starting point.
Go to Xcode and start an OpenGL-ES Project.
Export your maya-model to *.obj(Wavefront)-format and use Jeff Lamarches obj-loader to create c-header files that you can include into your iPhone project!
For a more modern example of rendering 3D meshes, check out this library. It comes with an OBJ parser, so if you can export your geometry as an OBJ file, you can render and interact with it using the library on iOS. Here's a short video of the library in action.

Is there an efficient and standardised code for multiple OpenGL ES Views on Iphone?

First of all thanks for taking the time to read through and attempt to help with the problem I'm having. First question posted here and after reading through the startup agreement I'll try and be descriptive as possible =)
I'm currently working on a Game for the Iphone as my final year university project. This game is one I hope to continue working on and expanding after I leave and use as a springboard for my CV into the industry. I've got a good few months left, so plenty of time to take things slowly and carefully plan it out.
I have a background in Java and OpenGL in C++ so I understand some of the basic fundamentals. I'm not that experienced in Objective C yet, need to start somewhere =), so I apologise for any obvious mistakes I'm making. The current state of code is i've got multiple items rendering to a single OpenGL ES view based on the OpenGL ES 1.1 model. I feel since the project is primarily 2D I shouldn't need to go to the higher version. I would post up the code I have but it's full of prototyping and misc code and is incredibly messy. In fact I wouldn't mind restarting the code as a multi view template then moving over the blocks of code as I get them working.
I've done research through many different mediums as to the ideal way to create a multi view application with each view being OpenGL-ES based. I've seen many tutorials on using the UI-kit view with an OpenGL view, but I've decided the best way for my project to ensure full dynamic and customisation I'd be happier using openGL for all the views.
TL;DR:
The question I'm trying to ask is if theres a good tutorial or template anywhere I'm missing that will allow me to start up a new multi view project that will allow me to switch between multiple views (Menus etc)?
You can't go far wrong with cocos2d if you're making a 2D app but want it to be openGL accelerated.

Getting a tiled image collection on the iPad (Deep Zoom)

I have a set of tiled image collections created via Microsoft's Deep Zoom composer, and a Silverlight application that currently consumes them for display via MultiScaleImage - it's all working pretty well - I'd just like to get some experience with iPad programming and
have a couple of ideas for some iPad applications. All my ideas rely on me being able to display/manipulate these tiled image sets (on the iPad).
I just picked up a iMac to facilitate this. I'm not seeing any Objective-C / Cocoa-touch libraries for this though, so am assuming I will have to roll my own. (I saw the Seadragon Ajax component, which is pretty slick, but I'm dealing with collections here, which it doesn't support. I would also like to roll this as a native application just to get the experience.)
The only open source project I found for displaying/manipulating the tiled image sets was Openzoom - a Flash component. I'm not to familiar with ActionScript either (Python, Java, C#, and c are the only languages I have really used), but briefly inspecting the code I didn't really have any issues with it and can probably use it for hints on how to swap the tiles in and out, etc. But, as I'm pretty new to Objective-C/Cocoa-touch, some pointers in the right direction would be appreciated.
1) Are there any other projects out there I am missing, or is OpenZoom my best bet for some reference?
2) Should I be trying to do this display in the UIKit framework, or should I do it as an OpenGL display?
3) Any other suggestions/pointers that I didn't think to ask.
I have just been working on a few apps that rely on tiling large images to allow for deep zooming. I found a couple of examples but the best and most useful for me was Apple's "PhotoScroller" sample code.
It relies on CATiledLayer to handle the tiling. The result is an extremely smooth and responsive interface even with very large images and its not too complex. (A little complex but not too bad).
So to answer your question directly:
PhotoScroller Code
QuartzCore Framework (which is part of the SDK)
There is a great, free little mac app for slicing images into tiles that I use a lot: "Tilen"
In the WWDC 2010 source samples, under iOS, there is a project in the ScrollView Suite called Tiling. It corresponds to WWDC10 session 104. It is probably the best image tiling example out there.
You can take a look at they way RouteMe library does this, the dynamic loading of higher resolution tiles, panning, etc. https://github.com/route-me/route-me
I can't believe nobody has told you about UIScrollview; the UIScrollView component is designed for this very purpose! (think Google Maps, which uses it).
Check out the class reference...
UIScrollView
The delegate method you require is the following....
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
This allows you to check the zoom level, offset etc and then provide a view for zooming. This way you can maintain your 'position' within the tiled landscape independently of the graphics used to represent it.
Don't roll your own UIScrollView, no need to!
Take a look at CATiled Layer. See my answer to a similar question here: Drawing in CATiledLayer with CoreGraphics CGContextDrawImage

Getting better at drawing in code for Cocoa?

What are some suggested "paths" for getting better at drawing in code in Cocoa? I think at this point, that's my biggest weakness. Is drawing in code something general, or Cocoa-specific?
Thanks!
- Jason
The best way is probably practice. Try drawing some simple things at first: a calendar (basically a grid), a custom button, or a digital clock.
Its also worth noting that a lot of 'custom' controls are made from images, so not that much of the drawing is done in code -- the only thing the code does is stitch those images together.
You might want to look at Opacity, a drawing app for OS X (I'm not affiliated with these folks, just discovered the app a few days ago). What sets Opacity apart from other drawing apps is that it can create Quartz code directly from your drawings. Naturally, the generated code is not perfect but in the few days I've been trying this app I've found it to be quite helpful in understanding how to use Quartz more effectively.
Drawing in code is need for creating custom controls no matter what UI toolkit you pick. Drawing in code certainly has its advantage, for example the application/framework that you are building is really lightweight come production time, cause there will be lot let resources(images/fonts/etc) to worry about.
Also if a problem arises changing drawing in code is a lot easier than to redo code and images together.
If you are doing Cocoa drawing start by looking at source code of BGHudAppKit and reading Cocoa Drawing Guide by Apple.
I'm in the same boat as you; I'd like to learn more about drawing code.
It's a big document, but the Quartz 2D programming guide on the developer website seems like a good place to start from. They introduce Graphics Contexts and Paths and include plenty of images.
There's also a book referenced in that document, Programming With Quartz: 2D and PDF Graphics in Mac OS X which looks good. The APIs for iPhone and OSX are almost identical, so there's no problem using a Mac OSX book.
So I'd suggest start with the Apple documentation (you don't need to read past the section on CGLayer drawing), try some sample code and figure out how it's working. Then move on to either that book or find more sample code on the web. Good luck!

UIView "suck" animation

I'd like to use the UIView "sucking" transition (view is "sucked" into a point) referenced here:
http://iphonedevwiki.net/index.php/UIViewAnimationState#Using_suckEffect
The method above, however, uses private APIs, which makes it next to useless for an App Store app. How can I recreate a similar effect without relying on private APIs? I'm guessing the answer has to do with OpenGL, although I have zero experience there.
As long as Apple doesn't publicly document the effect, and you want to avoid the risk of being rejected for using private API's you'll have to roll your own.
A suggestion to start working on this would be using OpenGL ES shaders.
The following blog post includes a demo Quartz Composer patch to create the Genie effect as seen in OS X and iOS:
http://www.aderstedtsoftware.com/users/erik/weblog/c7cb9/
A good start for your OpenGL ES shader would be to use the code in the Genie Filter in this QuartzComposer file. The code can almost be copied to a shader for OpenGL as is. The most work would probably be integrating OpenGL in your application: rendering the right view to a OpenGL texture and overlaying OpenGL over your application to perform the animation based on your shader.
Please have a look at my project at git://github.com/rmd6502/Genie.git - it's very slow right now, but improvements are forthcoming.
have you checkked out the cocos2d framework. it's an objective c wrapper for openGL and it's done really well. you can check out their demo video which shows all the transition types that the library supports.