Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-09-2009, 02:27 AM   #1 (permalink)
OMH
Registered Member
 
Join Date: Nov 2009
Location: Norway
Posts: 18
OMH is on a distinguished road
Default How to combine OpenGL ES template and Utility template?

I would like to have an OpenGL view with an utility application.

What I do: I create an OpenGL ES application template and a Utility Application template. I copy the files EAGLView.m and h, and the five ES*renderer.* files from the Opengl project to the utility project.

I copy these lines from the OpenGl project to the Utility project: (in utilityAppDelegate.m)

Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
[glView startAnimation];
}

- (void) applicationWillResignActive:(UIApplication *)application
{
[glView stopAnimation];
}

- (void) applicationDidBecomeActive:(UIApplication *)application
{
[glView startAnimation];
}

- (void)applicationWillTerminate:(UIApplication *)application
{
[glView stopAnimation];
}

- (void)dealloc {
...
 [glView release];
...
}
And in the utilityAppDelegate.h I add:

Code:
@class EAGLView;
EAGLView *glView;
@property (nonatomic, retain) IBOutlet EAGLView *glView;
I go to the view's identity inspector, and change the class identity to EAGLview.

I open the mainview.xib and mainwindow.xib and drag the app_delegate from the mainwindow.xib, to be able to connect the glView outlet to the view. (Don't know if this is the way to do it, but that's the only way I could connect the glView variable to the view)

When I build and run, the multi colored square show up on the screen, but it does not animate!

When I debug, the glView variable is 0 in applicationDidFinishLaunching, and the startAnimation is not called. I suspect this has something to to with the way the outlet is connected to the view? Probably not connected. :-) The mistake is probably obvious, but I have only been 5 weeks on this platform.

Why is the glView variable not set?

Thank you!

Last edited by OMH; 11-09-2009 at 03:27 AM.
OMH is offline   Reply With Quote
Old 11-10-2009, 06:20 AM   #2 (permalink)
OMH
Registered Member
 
Join Date: Nov 2009
Location: Norway
Posts: 18
OMH is on a distinguished road
Default

Anybody has a clue?
I don't.
I thought this would be an easy question to answer. Mabe too easy?
I'm sure there are other beginners who wants a quick way of creating an OpenGL/utility app.

Yes!?
OMH is offline   Reply With Quote
Old 11-10-2009, 01:43 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 5
sloth49 is on a distinguished road
Default

You arn't really giving enough of your code.

The first things that pop into my mind are, your timer isn't set up, or your openGL code doesn't have a glRotate in it so your screen isn't rotating. Are you saying glView.animationInterval=2.0/60.0 at some point to set your frame rate?

Most likely something with the timer, because when you call stopAnimation, that will give you the square but not rotating.

Last edited by sloth49; 11-10-2009 at 01:45 PM.
sloth49 is offline   Reply With Quote
Old 11-10-2009, 02:42 PM   #4 (permalink)
OMH
Registered Member
 
Join Date: Nov 2009
Location: Norway
Posts: 18
OMH is on a distinguished road
Default

Quote:
Originally Posted by sloth49 View Post
You arn't really giving enough of your code.

The first things that pop into my mind are, your timer isn't set up, or your openGL code doesn't have a glRotate in it so your screen isn't rotating. Are you saying glView.animationInterval=2.0/60.0 at some point to set your frame rate?

Most likely something with the timer, because when you call stopAnimation, that will give you the square but not rotating.
Well, attached is the whole source. (not much)

The problem is that the glView is still 0 at applicationDidFinishLaunching, for some reason.

But if I, instead of using the view in MainView.xib, create a new view on top of the window in MainWindow.xib, and connect this view to outlet glView, then it works.
(need to set view in mainview.xib transparent to see the view that is behind)

So then the opengl works fine, but the mainview with the i-button, is gone.

What is the issue here? How to connect the mainview to the glView outlet properly?
Attached Files
File Type: zip new_utility.zip (42.4 KB, 16 views)
OMH is offline   Reply With Quote
Old 11-17-2009, 02:16 AM   #5 (permalink)
OMH
Registered Member
 
Join Date: Nov 2009
Location: Norway
Posts: 18
OMH is on a distinguished road
Default

I got the solution in another forum:
iphonedevbook.com • View topic - How to combine OpenGL ES template and Utility template?

Basically, just add the glView outlet to the MainViewController instead of the AppDelegate
OMH is offline   Reply With Quote
Reply

Bookmarks

Tags
opengl, template, utility

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 339
11 members and 328 guests
alexP, ClerurcifeDer, Duncan C, givensur, glenn_sayers, guusleijsten, JmayLive, NetGuru, Punkjumper, whitey99, yys
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:42 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0