Just hooked up a gui using Interface Builder inside OF. The main window is still a glut window with an Objective C++ connection. This is my first attempt with Objective C, soo let me know what I did wrong.
Download the source
uh this looks great! very excited by the idea of having external UI hooked up to OF.
im running into a compile error in the init method of the OFGuiController class.
error: ‘ofGetAppPtr’ was not declared in this scope
Mac OS X 10.5.7
Intel Core 2 Duo
2 GB RAM
NVIDIA GeForce 8600M GT
I am running the latest version of OF. grab the latest and greatest from the svn.
ofGetAppPtr() is a ref to the testApp
FYI in the xcode project you have in that zip its referencing an incorrect path for the src folder (incorrect for all of us out here, presumably the path exists on your machine).
I put together Theo’s ofAppCocoaWindow (including the update from yesterday) and Vanderlins OF+IB Example, which gives me Vanderlins cool example in one cocoa window, which can be fullscreen (OpenGL View only in screen size) or in window mode (GUI + OpenGL)
As you can see, the menu’s also configurable (also via IB).
If someone is interested, give me space to upload it. Or I can send it via mail, so that someone else can do that!
All credits go to Theo and Vanderlin, they did the really hard work.
Wow, this looks interesting. Can you email it to me at firstname.lastname@example.org and I will post it up somewhere for people to download.
I added theos cocoa window as well. I’m still trying to do a crash course in objective c. main I keep say “wow cocoa is amazing, I can’t believe I can do that. Then 5 minutes later crap why can’t I do that.” haha
I want to make the main app controller a bit more visible I found this article, might be a better idea to abstract the the main NSApplication so that you can add others controllers.
Here is the code Gestalt worked on that was mentioned…
I am really interested in playing with this for a few reasons. I love OF because of the cross platform nature of it, otherwise I might just do cocoa development. However, there are times when I want to use platform specific functionality, one of those is integration with Quartz Composer and Webkit. I am stumbling around learning to integrate them. I will post any results.
just thought id bring this up as ive run out of time for today to look into it any further…
ofGetWidth() and ofGetHeight() are always returning 0 with ofAppCocoaWindow.
this is mucking up quite a lot of functionality within OF when trying to do screen grabs and using ofxTileSaver addon as they are dependent on those functions.
anyone know if this can be easily resolved?
will pick up looking into this again tomorrow.
I’m sorry, but here it works fine!
in testApp::keyReleased gives me always the right size. I tried that with theos, Vanderlins and my version! Only difference to of is, that the size changes to screen size if you go fullscreen.
I’m on 10.5.8, MBP Core Duo, XCode 3.1.2 if that helps.
thanks for checking.
i tried porting my code again into the Interface Builder example with better results.
ofGetWidth() and ofGetHeight() work now, but not in setup() which is where i was caching the values.
still can’t get screen grab to save out to a file though.
well, going to do some more digging around so its back to the mines for me.
Hmm when i try to compile it (under the svn version of 006) i get the following complle error:
/Users/jonas/Documents/udvilking/of_preRelease_v0.06_xcode_FAT/apps/jonas/ofAppCocoaWindowExampleWithIB/../../../libs/GLee/include/GLee.h:40:0 /Users/jonas/Documents/udvilking/of_preRelease_v0.06_xcode_FAT/apps/jonas/ofAppCocoaWindowExampleWithIB/../../../libs/GLee/include/GLee.h:40:3: error: #error gl.h included before glee.h
/Users/jonas/Documents/udvilking/of_preRelease_v0.06_xcode_FAT/apps/jonas/ofAppCocoaWindowExampleWithIB/../../../libs/GLee/include/GLee.h:44:0 /Users/jonas/Documents/udvilking/of_preRelease_v0.06_xcode_FAT/apps/jonas/ofAppCocoaWindowExampleWithIB/../../../libs/GLee/include/GLee.h:44:3: error: #error glext.h included before glee.h
I had the same error when trying to compile as 10.5 Version. Using 10.4 worked nice!
you have to include GLEE at the top of main.cpp
Check how I do it here:
Yea just solved it aswell hehe… In snow leopard you can’t compile under 10.4 sdk, so this is mandatory to do now.
i’m curious to know if anybody has been able to port todd’s code to version 061.
importing <Cocoa/Cocoa.h> makes the complier spit out a measly 2000 errors (referring to NS classes like NSString).
thanks for any advice,
i’d like to hear about solving @Mantissa’s problem
i recently had the same problem when trying to add some objective-c code in OF, everytime i included some objective-c in testApp.h i got lots of errors all pertaining to obejctive-c syntax…
i actually adapted this project using the approach to using objective-c in c++ files from your tablet class, but i realized that it’s difficult (maybe even impossible) to link the objective-c class to interface builder.
but i also couldn’t include any obj-c code in a .h file.
for that addon it didn’t mind because its best to keep the obj-c code hidden from the user so its all in the .mm file. But i’d like to know how to solve that, it’s probably some simple option in xcode.