Skip to content

Commit f2d5187

Browse files
committed
some fixes for itunes plugin support. still doesn't really work
1 parent 6941c48 commit f2d5187

File tree

4 files changed

+76
-34
lines changed

4 files changed

+76
-34
lines changed

src/projectM-iTunes/iprojectM.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#include "libprojectM/projectM.hpp"
5353
#include "getConfigFilename.h"
5454
#include <time.h>
55-
#include <OpenGL/gl.h>
55+
#include <OpenGL/gl3.h>
5656

5757
#if TARGET_OS_MAC
5858
#import <Cocoa/Cocoa.h>

src/projectM-iTunes/iprojectM.mm

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,29 @@ void initProjectM( VisualPluginData * visualPluginData ) {
3131
settings.menuFontURL = "/usr/local/share/projectM/fonts/VeraMono.ttf";
3232
//projectM *pm = new projectM(settings, 0);
3333

34+
NSLog(@"GL_VERSION: %s", glGetString(GL_VERSION));
35+
NSLog(@"GL_SHADING_LANGUAGE_VERSION: %s", glGetString(GL_SHADING_LANGUAGE_VERSION));
36+
NSLog(@"GL_VENDOR: %s", glGetString(GL_VENDOR));
37+
38+
NSLog(@"opening config");
39+
3440
// use config file
3541
projectM *pm = new projectM(cfg_path);
3642

3743
visualPluginData->pm = pm;
3844

3945
pm->selectRandom(true);
46+
NSLog(@"random selected");
47+
4048
}
4149

4250
void keypressProjectM( VisualPluginData * visualPluginData, projectMEvent event, projectMKeycode keycode, projectMModifier mod ) {
4351
visualPluginData->pm->key_handler(event, keycode, mod);
4452
}
4553

4654
void renderProjectMTexture( VisualPluginData * visualPluginData ){
55+
// this needs to be updated for gl3 (see SDL version)
56+
#if 0
4757
static int textureHandle = visualPluginData->pm->initRenderToTexture();
4858

4959
glClear(GL_COLOR_BUFFER_BIT);
@@ -82,6 +92,7 @@ void renderProjectMTexture( VisualPluginData * visualPluginData ){
8292

8393
glMatrixMode(GL_MODELVIEW);
8494
glDisable(GL_DEPTH_TEST);
95+
#endif
8596
}
8697

8798
//-------------------------------------------------------------------------------------------------
@@ -463,6 +474,6 @@ OSStatus RegisterVisualPlugin( PluginMessageInfo * messageInfo )
463474
playerMessageInfo.u.registerVisualPluginMessage.maxHeight = 0; // no max height limit
464475

465476
status = PlayerRegisterVisualPlugin( messageInfo->u.initMessage.appCookie, messageInfo->u.initMessage.appProc, &playerMessageInfo );
466-
477+
467478
return status;
468479
}

src/projectM-iTunes/iprojectM_mac.mm

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
// based on the iTunes SDK example code
55

6+
// https://www.fenestrated.net/mirrors/Apple%20Technotes%20(As%20of%202002)/tn/tn2016.html
7+
68
#import "iprojectM.hpp"
79

810
#import <AppKit/AppKit.h>
9-
#import <OpenGL/gl.h>
10-
#import <OpenGL/glu.h>
11+
#import <OpenGL/gl3.h>
1112
#import <string.h>
1213
#include "libprojectM/cocoatoprojectM.h"
1314

@@ -48,7 +49,6 @@ void DrawVisual( VisualPluginData * visualPluginData )
4849

4950
[[drawView openGLContext] makeCurrentContext];
5051
#endif
51-
5252
if (visualPluginData->pm == NULL) {
5353
initProjectM(visualPluginData);
5454

@@ -62,8 +62,9 @@ void DrawVisual( VisualPluginData * visualPluginData )
6262
// render
6363
visualPluginData->pm->renderFrame();
6464
//renderProjectMTexture(visualPluginData);
65-
66-
glFlush();
65+
66+
[[drawView openGLContext] flushBuffer];
67+
// glFlush();
6768

6869
return;
6970

@@ -250,6 +251,26 @@ @implementation VisualView
250251

251252
@synthesize visualPluginData = _visualPluginData;
252253

254+
- (id)initWithFrame:(NSRect)frame
255+
{
256+
NSLog(@"initWithFrame called");
257+
NSOpenGLPixelFormatAttribute pixelFormatAttributes[] =
258+
{
259+
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
260+
// NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core,
261+
NSOpenGLPFAColorSize , 24 ,
262+
NSOpenGLPFAAlphaSize , 8 ,
263+
NSOpenGLPFADoubleBuffer ,
264+
NSOpenGLPFAAccelerated ,
265+
NSOpenGLPFANoRecovery ,
266+
0
267+
};
268+
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
269+
self = [super initWithFrame:frame pixelFormat:pixelFormat];
270+
271+
return self;
272+
}
273+
253274
//-------------------------------------------------------------------------------------------------
254275
// isOpaque
255276
//-------------------------------------------------------------------------------------------------

src/projectM-iTunes/projectM Visualizer.xcodeproj/project.pbxproj

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
16A4214820781836006F30CE /* libRenderer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214420781835006F30CE /* libRenderer.a */; };
11-
16A4214920781836006F30CE /* libRenderer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214420781835006F30CE /* libRenderer.a */; };
12-
16A4214A20781836006F30CE /* libMilkdropPresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214520781835006F30CE /* libMilkdropPresetFactory.a */; };
13-
16A4214B20781836006F30CE /* libMilkdropPresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214520781835006F30CE /* libMilkdropPresetFactory.a */; };
14-
16A4214C20781836006F30CE /* libNativePresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214620781835006F30CE /* libNativePresetFactory.a */; };
15-
16A4214D20781836006F30CE /* libNativePresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214620781835006F30CE /* libNativePresetFactory.a */; };
16-
16A4214E20781836006F30CE /* libprojectM.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214720781836006F30CE /* libprojectM.a */; };
17-
16A4214F20781836006F30CE /* libprojectM.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214720781836006F30CE /* libprojectM.a */; };
10+
16FE0B2121157D62005F170D /* libMilkdropPresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 168F716D21125D85001806E7 /* libMilkdropPresetFactory.a */; };
11+
16FE0B2221157D63005F170D /* libNativePresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 168F716F21125D85001806E7 /* libNativePresetFactory.a */; };
12+
16FE0B2321157D63005F170D /* libprojectM.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 168F716B21125D85001806E7 /* libprojectM.a */; };
13+
16FE0B2421157D63005F170D /* libRenderer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 168F716921125D85001806E7 /* libRenderer.a */; };
1814
C34E811C1956D0D4001AC5B5 /* libz.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C34E811B1956D0D4001AC5B5 /* libz.a */; };
1915
C34E811E1956D0D6001AC5B5 /* libpng15.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C34E811D1956D0D6001AC5B5 /* libpng15.a */; };
2016
C34E81201956D0D8001AC5B5 /* libftgl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C34E811F1956D0D8001AC5B5 /* libftgl.a */; };
@@ -74,19 +70,23 @@
7470
remoteGlobalIDString = 1612C9AC207A856A00862A3A;
7571
remoteInfo = NativePresetFactory;
7672
};
73+
16FE0B1B21157D55005F170D /* PBXContainerItemProxy */ = {
74+
isa = PBXContainerItemProxy;
75+
containerPortal = 168F716121125D85001806E7 /* libprojectM.xcodeproj */;
76+
proxyType = 1;
77+
remoteGlobalIDString = 16A49E56207A7C8C00E508EA;
78+
remoteInfo = projectM;
79+
};
80+
16FE0B2521157D84005F170D /* PBXContainerItemProxy */ = {
81+
isa = PBXContainerItemProxy;
82+
containerPortal = C3F9D7A717B82CC3009E58CB /* Project object */;
83+
proxyType = 1;
84+
remoteGlobalIDString = C3F9D7AE17B82CC3009E58CB;
85+
remoteInfo = iProjectM;
86+
};
7787
/* End PBXContainerItemProxy section */
7888

7989
/* Begin PBXCopyFilesBuildPhase section */
80-
C3C24430195764660021FCD4 /* Copy Files */ = {
81-
isa = PBXCopyFilesBuildPhase;
82-
buildActionMask = 2147483647;
83-
dstPath = "";
84-
dstSubfolderSpec = 10;
85-
files = (
86-
);
87-
name = "Copy Files";
88-
runOnlyForDeploymentPostprocessing = 0;
89-
};
9090
C3FAE5A917B898BB00F4B110 /* plist */ = {
9191
isa = PBXCopyFilesBuildPhase;
9292
buildActionMask = 2147483647;
@@ -176,10 +176,6 @@
176176
isa = PBXFrameworksBuildPhase;
177177
buildActionMask = 2147483647;
178178
files = (
179-
16A4214D20781836006F30CE /* libNativePresetFactory.a in Frameworks */,
180-
16A4214920781836006F30CE /* libRenderer.a in Frameworks */,
181-
16A4214B20781836006F30CE /* libMilkdropPresetFactory.a in Frameworks */,
182-
16A4214F20781836006F30CE /* libprojectM.a in Frameworks */,
183179
C37EBD2C19A0112900220265 /* Cocoa.framework in Frameworks */,
184180
);
185181
runOnlyForDeploymentPostprocessing = 0;
@@ -188,14 +184,14 @@
188184
isa = PBXFrameworksBuildPhase;
189185
buildActionMask = 2147483647;
190186
files = (
187+
16FE0B2121157D62005F170D /* libMilkdropPresetFactory.a in Frameworks */,
188+
16FE0B2221157D63005F170D /* libNativePresetFactory.a in Frameworks */,
189+
16FE0B2321157D63005F170D /* libprojectM.a in Frameworks */,
190+
16FE0B2421157D63005F170D /* libRenderer.a in Frameworks */,
191191
C3C24435195764870021FCD4 /* libGLEW.a in Frameworks */,
192-
16A4214C20781836006F30CE /* libNativePresetFactory.a in Frameworks */,
193192
C34E81241956D0DA001AC5B5 /* libbz2.a in Frameworks */,
194193
C34E81221956D0D9001AC5B5 /* libfreetype.a in Frameworks */,
195-
16A4214A20781836006F30CE /* libMilkdropPresetFactory.a in Frameworks */,
196194
C34E81201956D0D8001AC5B5 /* libftgl.a in Frameworks */,
197-
16A4214820781836006F30CE /* libRenderer.a in Frameworks */,
198-
16A4214E20781836006F30CE /* libprojectM.a in Frameworks */,
199195
C34E811E1956D0D6001AC5B5 /* libpng15.a in Frameworks */,
200196
C34E811C1956D0D4001AC5B5 /* libz.a in Frameworks */,
201197
C3F9D7CF17B831F3009E58CB /* OpenGL.framework in Frameworks */,
@@ -366,6 +362,7 @@
366362
buildRules = (
367363
);
368364
dependencies = (
365+
16FE0B2621157D84005F170D /* PBXTargetDependency */,
369366
);
370367
name = "projectM Visualizer";
371368
productName = "projectM Visualizer";
@@ -379,13 +376,13 @@
379376
C3F9D7AB17B82CC3009E58CB /* Sources */,
380377
C3F9D7AC17B82CC3009E58CB /* Frameworks */,
381378
C3FAE5A917B898BB00F4B110 /* plist */,
382-
C3C24430195764660021FCD4 /* Copy Files */,
383379
C3FAF97317B89F1700F4B110 /* share */,
384380
C3FAE5AB17B898F800F4B110 /* Generate Installer Package */,
385381
);
386382
buildRules = (
387383
);
388384
dependencies = (
385+
16FE0B1C21157D55005F170D /* PBXTargetDependency */,
389386
);
390387
name = iProjectM;
391388
productName = iProjectM;
@@ -527,6 +524,19 @@
527524
};
528525
/* End PBXSourcesBuildPhase section */
529526

527+
/* Begin PBXTargetDependency section */
528+
16FE0B1C21157D55005F170D /* PBXTargetDependency */ = {
529+
isa = PBXTargetDependency;
530+
name = projectM;
531+
targetProxy = 16FE0B1B21157D55005F170D /* PBXContainerItemProxy */;
532+
};
533+
16FE0B2621157D84005F170D /* PBXTargetDependency */ = {
534+
isa = PBXTargetDependency;
535+
target = C3F9D7AE17B82CC3009E58CB /* iProjectM */;
536+
targetProxy = 16FE0B2521157D84005F170D /* PBXContainerItemProxy */;
537+
};
538+
/* End PBXTargetDependency section */
539+
530540
/* Begin PBXVariantGroup section */
531541
C37EBD3019A0112900220265 /* InfoPlist.strings */ = {
532542
isa = PBXVariantGroup;

0 commit comments

Comments
 (0)