diff --git a/src/projectM-iTunes/iprojectM.hpp b/src/projectM-iTunes/iprojectM.hpp index 92d9f0359..d89117c69 100644 --- a/src/projectM-iTunes/iprojectM.hpp +++ b/src/projectM-iTunes/iprojectM.hpp @@ -52,7 +52,7 @@ #include "libprojectM/projectM.hpp" #include "getConfigFilename.h" #include -#include +#include #if TARGET_OS_MAC #import diff --git a/src/projectM-iTunes/iprojectM.mm b/src/projectM-iTunes/iprojectM.mm index 4c02e2d23..febc06ad7 100644 --- a/src/projectM-iTunes/iprojectM.mm +++ b/src/projectM-iTunes/iprojectM.mm @@ -31,12 +31,20 @@ void initProjectM( VisualPluginData * visualPluginData ) { settings.menuFontURL = "/usr/local/share/projectM/fonts/VeraMono.ttf"; //projectM *pm = new projectM(settings, 0); + NSLog(@"GL_VERSION: %s", glGetString(GL_VERSION)); + NSLog(@"GL_SHADING_LANGUAGE_VERSION: %s", glGetString(GL_SHADING_LANGUAGE_VERSION)); + NSLog(@"GL_VENDOR: %s", glGetString(GL_VENDOR)); + + NSLog(@"opening config"); + // use config file projectM *pm = new projectM(cfg_path); visualPluginData->pm = pm; pm->selectRandom(true); + NSLog(@"random selected"); + } void keypressProjectM( VisualPluginData * visualPluginData, projectMEvent event, projectMKeycode keycode, projectMModifier mod ) { @@ -44,6 +52,8 @@ void keypressProjectM( VisualPluginData * visualPluginData, projectMEvent event, } void renderProjectMTexture( VisualPluginData * visualPluginData ){ + // this needs to be updated for gl3 (see SDL version) +#if 0 static int textureHandle = visualPluginData->pm->initRenderToTexture(); glClear(GL_COLOR_BUFFER_BIT); @@ -82,6 +92,7 @@ void renderProjectMTexture( VisualPluginData * visualPluginData ){ glMatrixMode(GL_MODELVIEW); glDisable(GL_DEPTH_TEST); +#endif } //------------------------------------------------------------------------------------------------- @@ -463,6 +474,6 @@ OSStatus RegisterVisualPlugin( PluginMessageInfo * messageInfo ) playerMessageInfo.u.registerVisualPluginMessage.maxHeight = 0; // no max height limit status = PlayerRegisterVisualPlugin( messageInfo->u.initMessage.appCookie, messageInfo->u.initMessage.appProc, &playerMessageInfo ); - + return status; } diff --git a/src/projectM-iTunes/iprojectM_mac.mm b/src/projectM-iTunes/iprojectM_mac.mm index ea0bfe9d1..6f772fc17 100644 --- a/src/projectM-iTunes/iprojectM_mac.mm +++ b/src/projectM-iTunes/iprojectM_mac.mm @@ -3,11 +3,12 @@ // based on the iTunes SDK example code +// https://www.fenestrated.net/mirrors/Apple%20Technotes%20(As%20of%202002)/tn/tn2016.html + #import "iprojectM.hpp" #import -#import -#import +#import #import #include "libprojectM/cocoatoprojectM.h" @@ -48,7 +49,6 @@ void DrawVisual( VisualPluginData * visualPluginData ) [[drawView openGLContext] makeCurrentContext]; #endif - if (visualPluginData->pm == NULL) { initProjectM(visualPluginData); @@ -62,8 +62,9 @@ void DrawVisual( VisualPluginData * visualPluginData ) // render visualPluginData->pm->renderFrame(); //renderProjectMTexture(visualPluginData); - - glFlush(); + + [[drawView openGLContext] flushBuffer]; +// glFlush(); return; @@ -250,6 +251,26 @@ OSStatus ConfigureVisual( VisualPluginData * visualPluginData ) @synthesize visualPluginData = _visualPluginData; +- (id)initWithFrame:(NSRect)frame +{ + NSLog(@"initWithFrame called"); + NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = + { + NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, +// NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core, + NSOpenGLPFAColorSize , 24 , + NSOpenGLPFAAlphaSize , 8 , + NSOpenGLPFADoubleBuffer , + NSOpenGLPFAAccelerated , + NSOpenGLPFANoRecovery , + 0 + }; + NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes]; + self = [super initWithFrame:frame pixelFormat:pixelFormat]; + + return self; +} + //------------------------------------------------------------------------------------------------- // isOpaque //------------------------------------------------------------------------------------------------- diff --git a/src/projectM-iTunes/projectM Visualizer.xcodeproj/project.pbxproj b/src/projectM-iTunes/projectM Visualizer.xcodeproj/project.pbxproj index 4c884d6d0..d88dcb6e6 100644 --- a/src/projectM-iTunes/projectM Visualizer.xcodeproj/project.pbxproj +++ b/src/projectM-iTunes/projectM Visualizer.xcodeproj/project.pbxproj @@ -7,14 +7,10 @@ objects = { /* Begin PBXBuildFile section */ - 16A4214820781836006F30CE /* libRenderer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214420781835006F30CE /* libRenderer.a */; }; - 16A4214920781836006F30CE /* libRenderer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214420781835006F30CE /* libRenderer.a */; }; - 16A4214A20781836006F30CE /* libMilkdropPresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214520781835006F30CE /* libMilkdropPresetFactory.a */; }; - 16A4214B20781836006F30CE /* libMilkdropPresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214520781835006F30CE /* libMilkdropPresetFactory.a */; }; - 16A4214C20781836006F30CE /* libNativePresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214620781835006F30CE /* libNativePresetFactory.a */; }; - 16A4214D20781836006F30CE /* libNativePresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214620781835006F30CE /* libNativePresetFactory.a */; }; - 16A4214E20781836006F30CE /* libprojectM.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214720781836006F30CE /* libprojectM.a */; }; - 16A4214F20781836006F30CE /* libprojectM.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214720781836006F30CE /* libprojectM.a */; }; + 16FE0B2121157D62005F170D /* libMilkdropPresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 168F716D21125D85001806E7 /* libMilkdropPresetFactory.a */; }; + 16FE0B2221157D63005F170D /* libNativePresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 168F716F21125D85001806E7 /* libNativePresetFactory.a */; }; + 16FE0B2321157D63005F170D /* libprojectM.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 168F716B21125D85001806E7 /* libprojectM.a */; }; + 16FE0B2421157D63005F170D /* libRenderer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 168F716921125D85001806E7 /* libRenderer.a */; }; C34E811C1956D0D4001AC5B5 /* libz.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C34E811B1956D0D4001AC5B5 /* libz.a */; }; C34E811E1956D0D6001AC5B5 /* libpng15.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C34E811D1956D0D6001AC5B5 /* libpng15.a */; }; C34E81201956D0D8001AC5B5 /* libftgl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C34E811F1956D0D8001AC5B5 /* libftgl.a */; }; @@ -74,19 +70,23 @@ remoteGlobalIDString = 1612C9AC207A856A00862A3A; remoteInfo = NativePresetFactory; }; + 16FE0B1B21157D55005F170D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 168F716121125D85001806E7 /* libprojectM.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 16A49E56207A7C8C00E508EA; + remoteInfo = projectM; + }; + 16FE0B2521157D84005F170D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3F9D7A717B82CC3009E58CB /* Project object */; + proxyType = 1; + remoteGlobalIDString = C3F9D7AE17B82CC3009E58CB; + remoteInfo = iProjectM; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - C3C24430195764660021FCD4 /* Copy Files */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Copy Files"; - runOnlyForDeploymentPostprocessing = 0; - }; C3FAE5A917B898BB00F4B110 /* plist */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -176,10 +176,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 16A4214D20781836006F30CE /* libNativePresetFactory.a in Frameworks */, - 16A4214920781836006F30CE /* libRenderer.a in Frameworks */, - 16A4214B20781836006F30CE /* libMilkdropPresetFactory.a in Frameworks */, - 16A4214F20781836006F30CE /* libprojectM.a in Frameworks */, C37EBD2C19A0112900220265 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -188,14 +184,14 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 16FE0B2121157D62005F170D /* libMilkdropPresetFactory.a in Frameworks */, + 16FE0B2221157D63005F170D /* libNativePresetFactory.a in Frameworks */, + 16FE0B2321157D63005F170D /* libprojectM.a in Frameworks */, + 16FE0B2421157D63005F170D /* libRenderer.a in Frameworks */, C3C24435195764870021FCD4 /* libGLEW.a in Frameworks */, - 16A4214C20781836006F30CE /* libNativePresetFactory.a in Frameworks */, C34E81241956D0DA001AC5B5 /* libbz2.a in Frameworks */, C34E81221956D0D9001AC5B5 /* libfreetype.a in Frameworks */, - 16A4214A20781836006F30CE /* libMilkdropPresetFactory.a in Frameworks */, C34E81201956D0D8001AC5B5 /* libftgl.a in Frameworks */, - 16A4214820781836006F30CE /* libRenderer.a in Frameworks */, - 16A4214E20781836006F30CE /* libprojectM.a in Frameworks */, C34E811E1956D0D6001AC5B5 /* libpng15.a in Frameworks */, C34E811C1956D0D4001AC5B5 /* libz.a in Frameworks */, C3F9D7CF17B831F3009E58CB /* OpenGL.framework in Frameworks */, @@ -366,6 +362,7 @@ buildRules = ( ); dependencies = ( + 16FE0B2621157D84005F170D /* PBXTargetDependency */, ); name = "projectM Visualizer"; productName = "projectM Visualizer"; @@ -379,13 +376,13 @@ C3F9D7AB17B82CC3009E58CB /* Sources */, C3F9D7AC17B82CC3009E58CB /* Frameworks */, C3FAE5A917B898BB00F4B110 /* plist */, - C3C24430195764660021FCD4 /* Copy Files */, C3FAF97317B89F1700F4B110 /* share */, C3FAE5AB17B898F800F4B110 /* Generate Installer Package */, ); buildRules = ( ); dependencies = ( + 16FE0B1C21157D55005F170D /* PBXTargetDependency */, ); name = iProjectM; productName = iProjectM; @@ -527,6 +524,19 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 16FE0B1C21157D55005F170D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = projectM; + targetProxy = 16FE0B1B21157D55005F170D /* PBXContainerItemProxy */; + }; + 16FE0B2621157D84005F170D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = C3F9D7AE17B82CC3009E58CB /* iProjectM */; + targetProxy = 16FE0B2521157D84005F170D /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ C37EBD3019A0112900220265 /* InfoPlist.strings */ = { isa = PBXVariantGroup;