mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-06 04:05:41 +00:00
Cg support again
This commit is contained in:
17
configure.ac
17
configure.ac
@ -45,6 +45,22 @@ AS_IF([test "x$enable_ftgl" = "xyes"], [
|
||||
AC_DEFINE([USE_FTGL], [1], [Define USE_FTGL])
|
||||
])
|
||||
|
||||
dnl Cg framework OSX -- replace with GLSL someday!
|
||||
CG_CFLAGS=
|
||||
CG_LDFLAGS=
|
||||
FRAMEWORK_SEARCH_PATHS="-F/Library/Frameworks -F$HOME/Library/Frameworks"
|
||||
AC_ARG_ENABLE([cg],
|
||||
AS_HELP_STRING([--enable-cg], [Cg framework for shaders]),
|
||||
[], [enable_cg=no])
|
||||
AS_IF([test "x$enable_cg" = "xyes"], [
|
||||
dnl AC_CHECK_HEADERS([Cg/cg.h], [], [AC_MSG_ERROR([Cg framework not found.])])
|
||||
AC_DEFINE([USE_CG], [1], [Define USE_CG])
|
||||
CG_LDFLAGS+="$FRAMEWORK_SEARCH_PATHS -framework Cg"
|
||||
CG_CFLAGS+="$FRAMEWORK_SEARCH_PATHS"
|
||||
])
|
||||
AC_SUBST([CG_CFLAGS])
|
||||
AC_SUBST([CG_LDFLAGS])
|
||||
|
||||
dnl from https://stackoverflow.com/questions/30897170/ac-subst-does-not-expand-variable answer: https://stackoverflow.com/a/30960268
|
||||
dnl ptomato https://stackoverflow.com/users/172999/ptomato
|
||||
AC_SUBST([PACKAGE])
|
||||
@ -128,4 +144,5 @@ libprojectM: yes
|
||||
SDL: ${enable_sdl}
|
||||
Qt & Pulseaudio: ${enable_qt}
|
||||
FTGL: ${enable_ftgl}
|
||||
CG: ${enable_cg}
|
||||
])
|
||||
|
||||
@ -8,14 +8,14 @@ AM_CPPFLAGS = \
|
||||
-DSYSCONFDIR=\""$(sysconfdir)"\" \
|
||||
-I$(top_srcdir)/src/libprojectM \
|
||||
-I$(top_srcdir)/src/libprojectM/Renderer \
|
||||
${FTGL_CFLAGS}
|
||||
$(FTGL_CFLAGS) $(CG_CFLAGS)
|
||||
|
||||
# system headers/libraries/data to install
|
||||
include_HEADERS = projectM.hpp
|
||||
lib_LTLIBRARIES = libprojectM.la # public, possibly-shared library
|
||||
|
||||
# link flags
|
||||
libprojectM_la_LDFLAGS = -no-undefined -version-info 0:2:0
|
||||
libprojectM_la_LDFLAGS = $(CG_LDFLAGS) -no-undefined -version-info 0:2:0
|
||||
|
||||
# link libRenderer, MilkdropPresetFactory, NativePresetFactory, and libprojectM sources
|
||||
libprojectM_la_LIBADD = \
|
||||
|
||||
@ -15,5 +15,5 @@ Eval.hpp MilkdropPresetFactory.hpp PresetFrameIO.hpp\
|
||||
Expr.hpp Param.hpp
|
||||
|
||||
:
|
||||
libMilkdropPresetFactory_la_CPPFLAGS = ${my_CFLAGS} \
|
||||
-I$(top_srcdir)/src/libprojectM
|
||||
libMilkdropPresetFactory_la_CPPFLAGS = $(my_CFLAGS) \
|
||||
-I$(top_srcdir)/src/libprojectM $(CG_CFLAGS)
|
||||
|
||||
@ -39,11 +39,10 @@ libRenderer_la_SOURCES = \
|
||||
SOIL2/stb_image.h SOIL2/stbi_pvr.h\
|
||||
SOIL2/stb_image_write.h SOIL2/stbi_pvr_c.h
|
||||
|
||||
|
||||
libRenderer_la_CPPFLAGS = ${my_CFLAGS} \
|
||||
-I$(top_srcdir)/src/libprojectM \
|
||||
${FTGL_CFLAGS}
|
||||
|
||||
${FTGL_CFLAGS} ${CG_CFLAGS} \
|
||||
-DDATADIR_PATH='"${pkgdatadir}"'
|
||||
|
||||
libRenderer_la_LDFLAGS = \
|
||||
${FTGL_LIBS}
|
||||
${FTGL_LIBS} ${CG_LDFLAGS}
|
||||
|
||||
@ -101,6 +101,8 @@ void ShaderEngine::setParams(const int texsize, const unsigned int texId, const
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
textureManager->setTexture("noise_hq", noise_texture_hq, 256, 256);
|
||||
// this is made-up
|
||||
textureManager->setTexture("texsize_noisevol_hq", noise_texture_hq_vol, 256, 256);
|
||||
|
||||
glGenTextures(1, &noise_texture_perlin);
|
||||
glBindTexture(GL_TEXTURE_2D, noise_texture_perlin);
|
||||
@ -342,7 +344,7 @@ void ShaderEngine::checkForCgError(const char *situation)
|
||||
void ShaderEngine::SetupCg()
|
||||
{
|
||||
std::string line;
|
||||
std::ifstream myfile(CMAKE_INSTALL_PREFIX "/share/projectM/shaders/projectM.cg");
|
||||
std::ifstream myfile(DATADIR_PATH "/shaders/projectM.cg");
|
||||
if (myfile.is_open())
|
||||
{
|
||||
while (!myfile.eof())
|
||||
@ -354,9 +356,9 @@ void ShaderEngine::SetupCg()
|
||||
}
|
||||
|
||||
else
|
||||
std::cout << "Unable to load shader template \"" << CMAKE_INSTALL_PREFIX "/share/projectM/shaders/projectM.cg\"" << std::endl;
|
||||
std::cout << "Unable to load shader template \"" << DATADIR_PATH << "/shaders/projectM.cg\"" << std::endl;
|
||||
|
||||
std::ifstream myfile2(CMAKE_INSTALL_PREFIX "/share/projectM/shaders/blur.cg");
|
||||
std::ifstream myfile2(DATADIR_PATH "/shaders/blur.cg");
|
||||
if (myfile2.is_open())
|
||||
{
|
||||
while (!myfile2.eof())
|
||||
@ -376,7 +378,7 @@ void ShaderEngine::SetupCg()
|
||||
cgSetParameterSettingMode(myCgContext, CG_DEFERRED_PARAMETER_SETTING);
|
||||
|
||||
myCgProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
|
||||
|
||||
|
||||
// HACK breaks with buggy ati video drivers such as my own
|
||||
// -carmelo.piccione@gmail.com 7/26/2010
|
||||
//cgGLSetOptimalOptions(myCgProfile);
|
||||
|
||||
@ -9,9 +9,9 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
161070DD1F705069001905AB /* Cg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 161070DC1F705069001905AB /* Cg.framework */; };
|
||||
169502001F7009E9008FAF86 /* pmSDL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 169501FE1F7009E9008FAF86 /* pmSDL.cpp */; };
|
||||
16A4214120781067006F30CE /* libRenderer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A4214020781067006F30CE /* libRenderer.a */; };
|
||||
16A9B64F20772F71003DF747 /* libMilkdropPresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A9B64E20772F71003DF747 /* libMilkdropPresetFactory.a */; };
|
||||
16A9B65120772F7C003DF747 /* libNativePresetFactory.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A9B65020772F7C003DF747 /* libNativePresetFactory.a */; };
|
||||
16A9B65320772F86003DF747 /* libRenderer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A9B65220772F85003DF747 /* libRenderer.a */; };
|
||||
16A9B655207732FF003DF747 /* libprojectM.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16A9B654207732FF003DF747 /* libprojectM.a */; };
|
||||
C307DFD41D565B57002F6B9E /* presets in CopyFiles */ = {isa = PBXBuildFile; fileRef = C307DFD31D565B57002F6B9E /* presets */; };
|
||||
C345214F1BF022A5001707D2 /* projectM_SDL_main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C345214E1BF022A5001707D2 /* projectM_SDL_main.cpp */; };
|
||||
@ -53,9 +53,9 @@
|
||||
161070DC1F705069001905AB /* Cg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cg.framework; path = ../../../../../../Library/Frameworks/Cg.framework; sourceTree = "<group>"; };
|
||||
169501FE1F7009E9008FAF86 /* pmSDL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = pmSDL.cpp; sourceTree = "<group>"; };
|
||||
169501FF1F7009E9008FAF86 /* pmSDL.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = pmSDL.hpp; sourceTree = "<group>"; };
|
||||
16A4214020781067006F30CE /* libRenderer.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libRenderer.a; path = ../libprojectM/Renderer/.libs/libRenderer.a; sourceTree = "<group>"; };
|
||||
16A9B64E20772F71003DF747 /* libMilkdropPresetFactory.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libMilkdropPresetFactory.a; path = ../libprojectM/MilkdropPresetFactory/.libs/libMilkdropPresetFactory.a; sourceTree = "<group>"; };
|
||||
16A9B65020772F7C003DF747 /* libNativePresetFactory.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libNativePresetFactory.a; path = ../libprojectM/NativePresetFactory/.libs/libNativePresetFactory.a; sourceTree = "<group>"; };
|
||||
16A9B65220772F85003DF747 /* libRenderer.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libRenderer.a; path = ../libprojectM/Renderer/.libs/libRenderer.a; sourceTree = "<group>"; };
|
||||
16A9B654207732FF003DF747 /* libprojectM.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libprojectM.a; path = ../libprojectM/.libs/libprojectM.a; sourceTree = "<group>"; };
|
||||
C307DFD31D565B57002F6B9E /* presets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = presets; path = ../../presets; sourceTree = "<group>"; };
|
||||
C34521441BF02294001707D2 /* SDLprojectM */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SDLprojectM; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@ -77,6 +77,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
161070DD1F705069001905AB /* Cg.framework in Frameworks */,
|
||||
16A4214120781067006F30CE /* libRenderer.a in Frameworks */,
|
||||
16A9B655207732FF003DF747 /* libprojectM.a in Frameworks */,
|
||||
16A9B64F20772F71003DF747 /* libMilkdropPresetFactory.a in Frameworks */,
|
||||
C345215E1BF025CF001707D2 /* CoreFoundation.framework in Frameworks */,
|
||||
@ -86,7 +87,6 @@
|
||||
C34521661BF025E5001707D2 /* libfreetype.a in Frameworks */,
|
||||
C34521671BF025E5001707D2 /* libftgl.a in Frameworks */,
|
||||
C34521681BF025E5001707D2 /* libGLEW.a in Frameworks */,
|
||||
16A9B65320772F86003DF747 /* libRenderer.a in Frameworks */,
|
||||
C34521691BF025E5001707D2 /* libpng15.a in Frameworks */,
|
||||
C345216A1BF025E5001707D2 /* libz.a in Frameworks */,
|
||||
);
|
||||
@ -105,6 +105,30 @@
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
16A42128207802AF006F30CE /* Dependencies */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C345215F1BF025E5001707D2 /* libbz2.a */,
|
||||
C34521601BF025E5001707D2 /* libfreetype.a */,
|
||||
C34521611BF025E5001707D2 /* libftgl.a */,
|
||||
C34521621BF025E5001707D2 /* libGLEW.a */,
|
||||
C34521631BF025E5001707D2 /* libpng15.a */,
|
||||
C34521641BF025E5001707D2 /* libz.a */,
|
||||
);
|
||||
name = Dependencies;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
16A42129207802C5006F30CE /* projectM libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
16A9B64E20772F71003DF747 /* libMilkdropPresetFactory.a */,
|
||||
16A9B65020772F7C003DF747 /* libNativePresetFactory.a */,
|
||||
16A9B654207732FF003DF747 /* libprojectM.a */,
|
||||
16A4214020781067006F30CE /* libRenderer.a */,
|
||||
);
|
||||
name = "projectM libraries";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C345213B1BF02293001707D2 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -112,16 +136,8 @@
|
||||
169501FF1F7009E9008FAF86 /* pmSDL.hpp */,
|
||||
C345214E1BF022A5001707D2 /* projectM_SDL_main.cpp */,
|
||||
C307DFD31D565B57002F6B9E /* presets */,
|
||||
C345215F1BF025E5001707D2 /* libbz2.a */,
|
||||
C34521601BF025E5001707D2 /* libfreetype.a */,
|
||||
C34521611BF025E5001707D2 /* libftgl.a */,
|
||||
C34521621BF025E5001707D2 /* libGLEW.a */,
|
||||
C34521631BF025E5001707D2 /* libpng15.a */,
|
||||
C34521641BF025E5001707D2 /* libz.a */,
|
||||
16A9B64E20772F71003DF747 /* libMilkdropPresetFactory.a */,
|
||||
16A9B65020772F7C003DF747 /* libNativePresetFactory.a */,
|
||||
16A9B65220772F85003DF747 /* libRenderer.a */,
|
||||
16A9B654207732FF003DF747 /* libprojectM.a */,
|
||||
16A42128207802AF006F30CE /* Dependencies */,
|
||||
16A42129207802C5006F30CE /* projectM libraries */,
|
||||
161070CE1F7041B0001905AB /* Frameworks */,
|
||||
C34521451BF02294001707D2 /* Products */,
|
||||
C3D30B8F1BF02BE5009AAACD /* fonts */,
|
||||
@ -314,6 +330,7 @@
|
||||
"$(PROJECT_DIR)",
|
||||
"$(SRCROOT)",
|
||||
);
|
||||
GCC_LINK_WITH_DYNAMIC_LIBRARIES = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/../libprojectM",
|
||||
"$(SRCROOT)/../../",
|
||||
@ -340,6 +357,7 @@
|
||||
"$(PROJECT_DIR)",
|
||||
"$(SRCROOT)",
|
||||
);
|
||||
GCC_LINK_WITH_DYNAMIC_LIBRARIES = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/../libprojectM",
|
||||
"$(SRCROOT)/../../",
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
#include "pmSDL.hpp"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
const int width = 1024, height = 768; // FIXME: use screen res?
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
|
||||
|
||||
if (! SDL_VERSION_ATLEAST(2, 0, 5)) {
|
||||
@ -20,9 +19,13 @@ int main(int argc, char *argv[]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// get path to our app
|
||||
std::string base_path = SDL_GetBasePath();
|
||||
|
||||
// default window size to usable bounds (e.g. minus menubar and dock)
|
||||
SDL_Rect initialWindowBounds;
|
||||
SDL_GetDisplayUsableBounds(0, &initialWindowBounds);
|
||||
int width = initialWindowBounds.w;
|
||||
int height = initialWindowBounds.h;
|
||||
float heightWidthRatio = (float)height / (float)width;
|
||||
|
||||
SDL_Window *win = SDL_CreateWindow("projectM", 0, 0, width, height, SDL_WINDOW_RESIZABLE);
|
||||
SDL_Renderer *rend = SDL_CreateRenderer(win, 0, SDL_RENDERER_ACCELERATED);
|
||||
if (! rend) {
|
||||
@ -30,13 +33,13 @@ int main(int argc, char *argv[]) {
|
||||
SDL_Quit();
|
||||
}
|
||||
SDL_SetWindowTitle(win, "projectM Visualizer");
|
||||
|
||||
|
||||
// init projectM
|
||||
projectM::Settings settings;
|
||||
settings.windowWidth = width;
|
||||
settings.windowHeight = height;
|
||||
settings.meshX = 1;
|
||||
settings.meshY = 1;
|
||||
settings.meshX = 200;
|
||||
settings.meshY = settings.meshX * heightWidthRatio;
|
||||
settings.fps = FPS;
|
||||
settings.textureSize = 2048; // idk?
|
||||
settings.smoothPresetDuration = 3; // seconds
|
||||
@ -46,6 +49,8 @@ int main(int argc, char *argv[]) {
|
||||
settings.easterEgg = 0; // ???
|
||||
settings.shuffleEnabled = 1;
|
||||
settings.softCutRatingsEnabled = 1; // ???
|
||||
// get path to our app
|
||||
std::string base_path = SDL_GetBasePath();
|
||||
settings.presetURL = base_path + "presets/presets_tryptonaut";
|
||||
settings.menuFontURL = base_path + "fonts/Vera.ttf";
|
||||
settings.titleFontURL = base_path + "fonts/Vera.ttf";
|
||||
|
||||
Reference in New Issue
Block a user