├── .gitattributes ├── .gitignore ├── Bins ├── FFGLTriangleMixer.dll.gz ├── FFGLTriangleMixer.rar ├── FFGLTriangleMixer.zip └── MacOSX │ └── FFGLTriangleMixer.bundle.zip ├── Docs ├── TriangleMX manual.docx └── TriangleMX usage.jpg ├── FFGL ├── FFGL.cpp ├── FFGL.h ├── FFGLExtensions.h ├── FFGLFBO.h ├── FFGLLib.h ├── FFGLPluginInfo.cpp ├── FFGLPluginInfo.h ├── FFGLPluginInfoData.cpp ├── FFGLPluginManager.cpp ├── FFGLPluginManager.h ├── FFGLPluginManager_inl.h ├── FFGLPluginSDK.cpp ├── FFGLPluginSDK.h ├── FFGLShader.h └── FreeFrame.h ├── FFGLGeometryMixer.cpp ├── FFGLGeometryMixer.h ├── FFGLGeometryMixer.vcxproj ├── FFGLGeometryMixer.vcxproj.filters ├── FFGLPlugins.def ├── FFGLTriangleMixer.sln ├── MacOSX ├── FFGLProject.xcconfig └── FFGLTriangeMixer.xcodeproj │ └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── FFGLTriangeMixer.xccheckout └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | MacOSX/FFGLTriangeMixer.xcodeproj/project.xcworkspace/xcuserdata/hybrid.xcuserdatad 217 | MacOSX/FFGLTriangeMixer.xcodeproj/xcuserdata/hybrid.xcuserdatad 218 | -------------------------------------------------------------------------------- /Bins/FFGLTriangleMixer.dll.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OlegPotiy/FFGLTriangleMX/b11524466b3770ba231c97fc5361f56bdd08dc7a/Bins/FFGLTriangleMixer.dll.gz -------------------------------------------------------------------------------- /Bins/FFGLTriangleMixer.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OlegPotiy/FFGLTriangleMX/b11524466b3770ba231c97fc5361f56bdd08dc7a/Bins/FFGLTriangleMixer.rar -------------------------------------------------------------------------------- /Bins/FFGLTriangleMixer.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OlegPotiy/FFGLTriangleMX/b11524466b3770ba231c97fc5361f56bdd08dc7a/Bins/FFGLTriangleMixer.zip -------------------------------------------------------------------------------- /Bins/MacOSX/FFGLTriangleMixer.bundle.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OlegPotiy/FFGLTriangleMX/b11524466b3770ba231c97fc5361f56bdd08dc7a/Bins/MacOSX/FFGLTriangleMixer.bundle.zip -------------------------------------------------------------------------------- /Docs/TriangleMX manual.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OlegPotiy/FFGLTriangleMX/b11524466b3770ba231c97fc5361f56bdd08dc7a/Docs/TriangleMX manual.docx -------------------------------------------------------------------------------- /Docs/TriangleMX usage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OlegPotiy/FFGLTriangleMX/b11524466b3770ba231c97fc5361f56bdd08dc7a/Docs/TriangleMX usage.jpg -------------------------------------------------------------------------------- /FFGL/FFGL.cpp: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // FFGL.cpp 3 | // 4 | // FreeFrame is an open-source cross-platform real-time video effects plugin system. 5 | // It provides a framework for developing video effects plugins and hosts on Windows, 6 | // Linux and Mac OSX. 7 | // 8 | // FreeFrameGL (FFGL) is an extension to the FreeFrame spec to support video processing 9 | // with OpenGL on Windows, Linux, and Mac OSX. 10 | // 11 | // Copyright (c) 2002, 2003, 2004, 2006 www.freeframe.org 12 | // All rights reserved. 13 | // 14 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 15 | 16 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistributions of source code must retain the above copyright 22 | // notice, this list of conditions and the following disclaimer. 23 | // * Redistributions in binary form must reproduce the above copyright 24 | // notice, this list of conditions and the following disclaimer in 25 | // the documentation and/or other materials provided with the 26 | // distribution. 27 | // * Neither the name of FreeFrame nor the names of its 28 | // contributors may be used to endorse or promote products derived 29 | // from this software without specific prior written permission. 30 | // 31 | // 32 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 33 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 34 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 35 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 36 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 37 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 38 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 39 | // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 40 | // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 41 | // OF THE POSSIBILITY OF SUCH DAMAGE. 42 | // 43 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 44 | 45 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 46 | // 47 | // First version, Marcus Clements (marcus@freeframe.org) 48 | // www.freeframe.org 49 | // 50 | // FreeFrame 1.0 upgrade by Russell Blakeborough 51 | // email: boblists@brightonart.org 52 | // 53 | // FreeFrame 1.0 - 03 upgrade 54 | // and implementation of FreeFrame SDK methods by Gualtiero Volpe 55 | // email: Gualtiero.Volpe@poste.it 56 | // 57 | // FFGL upgrade by Trey Harrison 58 | // email: trey@harrisondigitalmedia.com 59 | // 60 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 61 | 62 | 63 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 64 | // Includes 65 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 66 | 67 | #include "FFGLPluginSDK.h" 68 | #include 69 | 70 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 71 | // Static and extern variables used in the FreeFrame SDK 72 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 73 | 74 | extern CFFGLPluginInfo* g_CurrPluginInfo; 75 | 76 | static CFreeFrameGLPlugin* s_pPrototype = NULL; 77 | 78 | 79 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 80 | // FreeFrame SDK default implementation of the FreeFrame global functions. 81 | // Such function are called by the plugMain function, the only function a plugin exposes. 82 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 83 | 84 | void *getInfo() 85 | { 86 | return (void *)(g_CurrPluginInfo->GetPluginInfo()); 87 | } 88 | 89 | DWORD initialise() 90 | { 91 | if (g_CurrPluginInfo==NULL) 92 | return FF_FAIL; 93 | 94 | if (s_pPrototype==NULL) 95 | { 96 | //get the instantiate function pointer 97 | FPCREATEINSTANCEGL *pInstantiate = g_CurrPluginInfo->GetFactoryMethod(); 98 | 99 | //call the instantiate function 100 | DWORD dwRet = pInstantiate(&s_pPrototype); 101 | 102 | //make sure the instantiate call worked 103 | if ((dwRet == FF_FAIL) || (s_pPrototype == NULL)) 104 | return FF_FAIL; 105 | 106 | return FF_SUCCESS; 107 | } 108 | 109 | return FF_SUCCESS; 110 | } 111 | 112 | DWORD deInitialise() 113 | { 114 | if (s_pPrototype != NULL) { 115 | delete s_pPrototype; 116 | s_pPrototype = NULL; 117 | } 118 | return FF_SUCCESS; 119 | } 120 | 121 | DWORD getNumParameters() 122 | { 123 | if (s_pPrototype == NULL) { 124 | DWORD dwRet = initialise(); 125 | if (dwRet == FF_FAIL) return FF_FAIL; 126 | } 127 | 128 | return (DWORD) s_pPrototype->GetNumParams(); 129 | } 130 | 131 | char* getParameterName(DWORD index) 132 | { 133 | if (s_pPrototype == NULL) { 134 | DWORD dwRet = initialise(); 135 | if (dwRet == FF_FAIL) return NULL; 136 | } 137 | 138 | return s_pPrototype->GetParamName(index); 139 | } 140 | 141 | DWORD getParameterDefault(DWORD index) 142 | { 143 | if (s_pPrototype == NULL) { 144 | DWORD dwRet = initialise(); 145 | if (dwRet == FF_FAIL) return FF_FAIL; 146 | } 147 | 148 | void* pValue = s_pPrototype->GetParamDefault(index); 149 | if (pValue == NULL) return FF_FAIL; 150 | else { 151 | DWORD dwRet; 152 | memcpy(&dwRet, pValue, 4); 153 | return dwRet; 154 | } 155 | } 156 | 157 | DWORD getPluginCaps(DWORD index) 158 | { 159 | int MinInputs = -1; 160 | int MaxInputs = -1; 161 | 162 | if (s_pPrototype == NULL) { 163 | DWORD dwRet = initialise(); 164 | if (dwRet == FF_FAIL) return FF_FAIL; 165 | } 166 | 167 | switch (index) { 168 | 169 | case FF_CAP_16BITVIDEO: 170 | return FF_FALSE; 171 | 172 | case FF_CAP_24BITVIDEO: 173 | return FF_FALSE; 174 | 175 | case FF_CAP_32BITVIDEO: 176 | return FF_FALSE; 177 | 178 | case FF_CAP_PROCESSFRAMECOPY: 179 | return FF_FALSE; 180 | 181 | case FF_CAP_PROCESSOPENGL: 182 | return FF_TRUE; 183 | 184 | case FF_CAP_SETTIME: 185 | if (s_pPrototype->GetTimeSupported()) 186 | return FF_TRUE; 187 | else 188 | return FF_FALSE; 189 | 190 | case FF_CAP_MINIMUMINPUTFRAMES: 191 | MinInputs = s_pPrototype->GetMinInputs(); 192 | if (MinInputs < 0) return FF_FALSE; 193 | return DWORD(MinInputs); 194 | 195 | case FF_CAP_MAXIMUMINPUTFRAMES: 196 | MaxInputs = s_pPrototype->GetMaxInputs(); 197 | if (MaxInputs < 0) return FF_FALSE; 198 | return DWORD(MaxInputs); 199 | 200 | case FF_CAP_COPYORINPLACE: 201 | return FF_FALSE; 202 | 203 | default: 204 | return FF_FALSE; 205 | } 206 | 207 | return FF_FAIL; 208 | } 209 | 210 | void *getExtendedInfo() 211 | { 212 | return (void *)(g_CurrPluginInfo->GetPluginExtendedInfo()); 213 | } 214 | 215 | DWORD getParameterType(DWORD index) 216 | { 217 | if (s_pPrototype == NULL) { 218 | DWORD dwRet = initialise(); 219 | if (dwRet == FF_FAIL) return FF_FAIL; 220 | } 221 | 222 | return s_pPrototype->GetParamType(index); 223 | } 224 | 225 | DWORD instantiateGL(const FFGLViewportStruct *pGLViewport) 226 | { 227 | if (g_CurrPluginInfo==NULL || pGLViewport==NULL) 228 | return FF_FAIL; 229 | 230 | // If the plugin is not initialized, initialize it 231 | if (s_pPrototype == NULL) 232 | { 233 | DWORD dwRet = initialise(); 234 | 235 | if ((dwRet == FF_FAIL) || (s_pPrototype == NULL)) 236 | return FF_FAIL; 237 | } 238 | 239 | //get the instantiate function pointer 240 | FPCREATEINSTANCEGL *pInstantiate = g_CurrPluginInfo->GetFactoryMethod(); 241 | 242 | CFreeFrameGLPlugin *pInstance = NULL; 243 | 244 | //call the instantiate function 245 | DWORD dwRet = pInstantiate(&pInstance); 246 | 247 | //make sure the instantiate call worked 248 | if ((dwRet == FF_FAIL) || (pInstance == NULL)) 249 | return FF_FAIL; 250 | 251 | pInstance->m_pPlugin = pInstance; 252 | 253 | // Initializing instance with default values 254 | for (int i = 0; i < s_pPrototype->GetNumParams(); ++i) 255 | { 256 | //DWORD dwType = s_pPrototype->GetParamType(DWORD(i)); 257 | void* pValue = s_pPrototype->GetParamDefault(DWORD(i)); 258 | SetParameterStruct ParamStruct; 259 | ParamStruct.ParameterNumber = DWORD(i); 260 | 261 | //#ifdef FFGLTEXTFIX 262 | if( s_pPrototype->GetParamType(DWORD(i)) == FF_TYPE_TEXT ) 263 | { 264 | ParamStruct.NewParameterValue = (DWORD)pValue; 265 | } 266 | else 267 | { 268 | memcpy(&ParamStruct.NewParameterValue, pValue, 4); 269 | } 270 | /* 271 | #else 272 | memcpy(&ParamStruct.NewParameterValue, pValue, 4); 273 | #endif 274 | */ 275 | 276 | dwRet = pInstance->SetParameter(&ParamStruct); 277 | if (dwRet == FF_FAIL) 278 | { 279 | //SetParameter failed, delete the instance 280 | delete pInstance; 281 | return FF_FAIL; 282 | } 283 | } 284 | 285 | //call the InitGL method 286 | if (pInstance->InitGL(pGLViewport)==FF_SUCCESS) 287 | { 288 | //succes? we're done. 289 | return (DWORD)pInstance; 290 | } 291 | 292 | //InitGL failed, delete the instance 293 | pInstance->DeInitGL(); 294 | delete pInstance; 295 | 296 | return FF_FAIL; 297 | } 298 | 299 | DWORD deInstantiateGL(void *instanceID) 300 | { 301 | CFreeFrameGLPlugin *p = (CFreeFrameGLPlugin *)instanceID; 302 | 303 | if (p != NULL) 304 | { 305 | p->DeInitGL(); 306 | delete p; 307 | 308 | return FF_SUCCESS; 309 | } 310 | 311 | return FF_FAIL; 312 | } 313 | 314 | 315 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 316 | // Implementation of plugMain, the one and only exposed function 317 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 318 | 319 | #ifdef WIN32 320 | 321 | plugMainUnion __stdcall plugMain(DWORD functionCode, DWORD inputValue, DWORD instanceID) 322 | 323 | #elif TARGET_OS_MAC 324 | 325 | plugMainUnion plugMain(DWORD functionCode, DWORD inputValue, DWORD instanceID) 326 | 327 | #elif __linux__ 328 | 329 | plugMainUnion plugMain(DWORD functionCode, DWORD inputValue, DWORD instanceID) 330 | 331 | #endif 332 | 333 | { 334 | plugMainUnion retval; 335 | 336 | // declare pPlugObj - pointer to this instance 337 | CFreeFrameGLPlugin* pPlugObj; 338 | 339 | // typecast DWORD into pointer to a CFreeFrameGLPlugin 340 | pPlugObj = (CFreeFrameGLPlugin*) instanceID; 341 | 342 | switch (functionCode) { 343 | 344 | case FF_GETINFO: 345 | retval.PISvalue = (PluginInfoStruct*)getInfo(); 346 | break; 347 | 348 | case FF_INITIALISE: 349 | retval.ivalue = initialise(); 350 | break; 351 | 352 | case FF_DEINITIALISE: 353 | retval.ivalue = deInitialise(); 354 | break; 355 | 356 | case FF_GETNUMPARAMETERS: 357 | retval.ivalue = getNumParameters(); 358 | break; 359 | 360 | case FF_GETPARAMETERNAME: 361 | retval.svalue = getParameterName(inputValue); 362 | break; 363 | 364 | case FF_GETPARAMETERDEFAULT: 365 | retval.ivalue = getParameterDefault(inputValue); 366 | break; 367 | 368 | case FF_GETPLUGINCAPS: 369 | retval.ivalue = getPluginCaps(inputValue); 370 | break; 371 | 372 | case FF_GETEXTENDEDINFO: 373 | retval.ivalue = (DWORD) getExtendedInfo(); 374 | break; 375 | 376 | case FF_GETPARAMETERTYPE: 377 | retval.ivalue = getParameterType(inputValue); 378 | break; 379 | 380 | case FF_GETPARAMETERDISPLAY: 381 | if (pPlugObj != NULL) 382 | retval.svalue = pPlugObj->GetParameterDisplay(inputValue); 383 | else 384 | retval.svalue = (char*)FF_FAIL; 385 | break; 386 | 387 | case FF_SETPARAMETER: 388 | if (pPlugObj != NULL) 389 | retval.ivalue = pPlugObj->SetParameter((const SetParameterStruct*) inputValue); 390 | else 391 | retval.ivalue = FF_FAIL; 392 | break; 393 | 394 | case FF_GETPARAMETER: 395 | if (pPlugObj != NULL) 396 | retval.ivalue = pPlugObj->GetParameter(inputValue); 397 | else 398 | retval.ivalue = FF_FAIL; 399 | break; 400 | 401 | case FF_INSTANTIATEGL: 402 | retval.ivalue = (DWORD)instantiateGL((const FFGLViewportStruct *)inputValue); 403 | break; 404 | 405 | case FF_DEINSTANTIATEGL: 406 | if (pPlugObj != NULL) 407 | retval.ivalue = deInstantiateGL(pPlugObj); 408 | else 409 | retval.ivalue = FF_FAIL; 410 | break; 411 | 412 | case FF_GETIPUTSTATUS: 413 | if (pPlugObj != NULL) 414 | retval.ivalue = pPlugObj->GetInputStatus(inputValue); 415 | else 416 | retval.ivalue = FF_FAIL; 417 | break; 418 | 419 | case FF_PROCESSOPENGL: 420 | if (pPlugObj != NULL) 421 | { 422 | ProcessOpenGLStruct *pogls = (ProcessOpenGLStruct *)inputValue; 423 | if (pogls!=NULL) 424 | retval.ivalue = pPlugObj->ProcessOpenGL(pogls); 425 | else 426 | retval.ivalue = FF_FAIL; 427 | } 428 | else 429 | retval.ivalue = FF_FAIL; 430 | break; 431 | 432 | case FF_SETTIME: 433 | if (pPlugObj != NULL) 434 | { 435 | double *inputTime = (double *)inputValue; 436 | if (inputTime!=NULL) 437 | retval.ivalue = pPlugObj->SetTime(*inputTime); 438 | else 439 | retval.ivalue = FF_FAIL; 440 | } 441 | else 442 | retval.ivalue = FF_FAIL; 443 | break; 444 | 445 | //these old FF functions must always fail for FFGL plugins 446 | case FF_INSTANTIATE: 447 | case FF_DEINSTANTIATE: 448 | case FF_PROCESSFRAME: 449 | case FF_PROCESSFRAMECOPY: 450 | default: 451 | retval.ivalue = FF_FAIL; 452 | break; 453 | } 454 | 455 | return retval; 456 | } 457 | -------------------------------------------------------------------------------- /FFGL/FFGL.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // FFGL.h 3 | // 4 | // FreeFrame is an open-source cross-platform real-time video effects plugin system. 5 | // It provides a framework for developing video effects plugins and hosts on Windows, 6 | // Linux and Mac OSX. 7 | // 8 | // Copyright (c) 2006 www.freeframe.org 9 | // All rights reserved. 10 | // 11 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 12 | 13 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 14 | // FFGL.h by Trey Harrison 15 | // www.harrisondigitalmedia.com 16 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 17 | 18 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 19 | // 20 | // Redistribution and use in source and binary forms, with or without modification, 21 | // are permitted provided that the following conditions are met: 22 | // 23 | // * Redistributions of source code must retain the above copyright 24 | // notice, this list of conditions and the following disclaimer. 25 | // * Redistributions in binary form must reproduce the above copyright 26 | // notice, this list of conditions and the following disclaimer in 27 | // the documentation and/or other materials provided with the 28 | // distribution. 29 | // * Neither the name of FreeFrame nor the names of its 30 | // contributors may be used to endorse or promote products derived 31 | // from this software without specific prior written permission. 32 | // 33 | // 34 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 35 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 36 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 37 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 38 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 39 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 40 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 41 | // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 42 | // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 43 | // OF THE POSSIBILITY OF SUCH DAMAGE. 44 | // 45 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 46 | 47 | #ifndef __FFGL_H__ 48 | #define __FFGL_H__ 49 | 50 | ////////////////////////////////////////////////////////////////////////////////////// 51 | // Includes 52 | ///////////////////////////////////////////////////////////////////////////////////// 53 | 54 | //include the appropriate OpenGL headers for the compiler 55 | 56 | 57 | #ifdef _WIN32 58 | 59 | #include 60 | #include 61 | 62 | #else 63 | 64 | #ifdef TARGET_OS_MAC 65 | //on osx, auto-includes gl_ext.h for OpenGL extensions, which will interfere 66 | //with the FFGL SDK's own FFGLExtensions headers (included below). this #define disables 67 | //the auto-inclusion of gl_ext.h in OpenGl.h on OSX 68 | #define GL_GLEXT_LEGACY 69 | #include 70 | 71 | #else 72 | #ifdef __linux__ 73 | 74 | #include 75 | 76 | #else 77 | 78 | #error define this for your OS 79 | 80 | #endif 81 | #endif 82 | #endif 83 | 84 | 85 | 86 | 87 | 88 | ///////////////////////////////////////////////////////////////////////////// 89 | //FreeFrameGL defines numerically extend FreeFrame defines (see FreeFrame.h) 90 | ///////////////////////////////////////////////////////////////////////////// 91 | #include "FreeFrame.h" 92 | 93 | // new function codes for FFGL 94 | #define FF_PROCESSOPENGL 17 95 | #define FF_INSTANTIATEGL 18 96 | #define FF_DEINSTANTIATEGL 19 97 | #define FF_SETTIME 20 98 | 99 | // new plugin capabilities for FFGL 100 | #define FF_CAP_PROCESSOPENGL 4 101 | #define FF_CAP_SETTIME 5 102 | 103 | //FFGLViewportStruct (for InstantiateGL) 104 | typedef struct FFGLViewportStructTag 105 | { 106 | GLuint x,y,width,height; 107 | } FFGLViewportStruct; 108 | 109 | //FFGLTextureStruct (for ProcessOpenGLStruct) 110 | typedef struct FFGLTextureStructTag 111 | { 112 | DWORD Width, Height; 113 | DWORD HardwareWidth, HardwareHeight; 114 | GLuint Handle; //the actual texture handle, from glGenTextures() 115 | } FFGLTextureStruct; 116 | 117 | 118 | // ProcessOpenGLStruct 119 | typedef struct ProcessOpenGLStructTag { 120 | DWORD numInputTextures; 121 | FFGLTextureStruct **inputTextures; 122 | 123 | //if the host calls ProcessOpenGL with a framebuffer object actively bound 124 | //(as is the case when the host is capturing the plugins output to an offscreen texture) 125 | //the host must provide the GL handle to its EXT_framebuffer_object 126 | //so that the plugin can restore that binding if the plugin 127 | //makes use of its own FBO's for intermediate rendering 128 | GLuint HostFBO; 129 | } ProcessOpenGLStruct; 130 | 131 | 132 | #endif 133 | -------------------------------------------------------------------------------- /FFGL/FFGLExtensions.h: -------------------------------------------------------------------------------- 1 | #ifndef FFGLEXTENSIONS_H 2 | #define FFGLEXTENSIONS_H 3 | 4 | //originally this file came from SGI. 5 | //Lev Povalahev extended it with his great library "GLew". 6 | 7 | //The GLew headers have been reduced to a minimal set of extensions 8 | //required by the sample host and plugins in the FFGL SDK by 9 | //Trey Harrison - www.harrisondigitalmedia.com 10 | 11 | /* 12 | ** License Applicability. Except to the extent portions of this file are 13 | ** made subject to an alternative license as permitted in the SGI Free 14 | ** Software License B, Version 1.1 (the "License"), the contents of this 15 | ** file are subject only to the provisions of the License. You may not use 16 | ** this file except in compliance with the License. You may obtain a copy 17 | ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 18 | ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: 19 | ** 20 | ** http://oss.sgi.com/projects/FreeB 21 | ** 22 | ** Note that, as provided in the License, the Software is distributed on an 23 | ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS 24 | ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND 25 | ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A 26 | ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. 27 | ** 28 | ** Original Code. The Original Code is: OpenGL Sample Implementation, 29 | ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, 30 | ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. 31 | ** Copyright in any portions created by third parties is as indicated 32 | ** elsewhere herein. All Rights Reserved. 33 | ** 34 | ** Additional Notice Provisions: This software was created using the 35 | ** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has 36 | ** not been independently verified as being compliant with the OpenGL(R) 37 | ** version 1.2.1 Specification. 38 | */ 39 | 40 | /* Most parts copyright (c) 2001-2002 Lev Povalahev under this lisence: */ 41 | 42 | /* ---------------------------------------------------------------------------- 43 | Copyright (c) 2002, Lev Povalahev 44 | All rights reserved. 45 | 46 | Redistribution and use in source and binary forms, with or without modification, 47 | are permitted provided that the following conditions are met: 48 | 49 | * Redistributions of source code must retain the above copyright notice, 50 | this list of conditions and the following disclaimer. 51 | * Redistributions in binary form must reproduce the above copyright notice, 52 | this list of conditions and the following disclaimer in the documentation 53 | and/or other materials provided with the distribution. 54 | * The name of the author may be used to endorse or promote products 55 | derived from this software without specific prior written permission. 56 | 57 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 58 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 59 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 60 | IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 61 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 62 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 63 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 64 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 66 | THE POSSIBILITY OF SUCH DAMAGE. 67 | ------------------------------------------------------------------------------*/ 68 | 69 | #ifdef _WIN32 70 | 71 | #ifndef APIENTRY 72 | #define APIENTRY __stdcall 73 | #endif 74 | 75 | #else 76 | 77 | #ifdef TARGET_OS_MAC 78 | 79 | #define APIENTRY 80 | 81 | #else 82 | #ifdef __linux__ 83 | 84 | // APIENTRY is defined in gl.h 85 | 86 | #else 87 | 88 | #error #define APIENTRY for your platform 89 | 90 | #endif 91 | #endif 92 | #endif 93 | 94 | /////////////// 95 | // OpenGL 1.2 96 | /////////////// 97 | 98 | #define GL_CLAMP_TO_EDGE 0x812F 99 | #define GL_TEXTURE_3D 0x806F 100 | 101 | /////////////// 102 | // OpenGL 1.3 Multitexture 103 | /////////////// 104 | 105 | #define GL_TEXTURE0 0x84C0 106 | #define GL_TEXTURE1 0x84C1 107 | #define GL_TEXTURE2 0x84C2 108 | #define GL_TEXTURE3 0x84C3 109 | #define GL_TEXTURE4 0x84C4 110 | #define GL_TEXTURE5 0x84C5 111 | #define GL_TEXTURE6 0x84C6 112 | #define GL_TEXTURE7 0x84C7 113 | #define GL_TEXTURE8 0x84C8 114 | #define GL_TEXTURE9 0x84C9 115 | #define GL_TEXTURE10 0x84CA 116 | #define GL_TEXTURE11 0x84CB 117 | #define GL_TEXTURE12 0x84CC 118 | #define GL_TEXTURE13 0x84CD 119 | #define GL_TEXTURE14 0x84CE 120 | #define GL_TEXTURE15 0x84CF 121 | #define GL_TEXTURE16 0x84D0 122 | #define GL_TEXTURE17 0x84D1 123 | #define GL_TEXTURE18 0x84D2 124 | #define GL_TEXTURE19 0x84D3 125 | #define GL_TEXTURE20 0x84D4 126 | #define GL_TEXTURE21 0x84D5 127 | #define GL_TEXTURE22 0x84D6 128 | #define GL_TEXTURE23 0x84D7 129 | #define GL_TEXTURE24 0x84D8 130 | #define GL_TEXTURE25 0x84D9 131 | #define GL_TEXTURE26 0x84DA 132 | #define GL_TEXTURE27 0x84DB 133 | #define GL_TEXTURE28 0x84DC 134 | #define GL_TEXTURE29 0x84DD 135 | #define GL_TEXTURE30 0x84DE 136 | #define GL_TEXTURE31 0x84DF 137 | #define GL_ACTIVE_TEXTURE 0x84E0 138 | #define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 139 | #define GL_MAX_TEXTURE_UNITS 0x84E2 140 | 141 | typedef void (APIENTRY *glActiveTexturePROC) (GLenum texture ); 142 | typedef void (APIENTRY *glClientActiveTexturePROC) (GLenum texture ); 143 | typedef void (APIENTRY *glMultiTexCoord1dPROC) (GLenum target, GLdouble s ); 144 | typedef void (APIENTRY *glMultiTexCoord1dvPROC) (GLenum target, const GLdouble *v ); 145 | typedef void (APIENTRY *glMultiTexCoord1fPROC) (GLenum target, GLfloat s ); 146 | typedef void (APIENTRY *glMultiTexCoord1fvPROC) (GLenum target, const GLfloat *v ); 147 | typedef void (APIENTRY *glMultiTexCoord1iPROC) (GLenum target, GLint s ); 148 | typedef void (APIENTRY *glMultiTexCoord1ivPROC) (GLenum target, const GLint *v ); 149 | typedef void (APIENTRY *glMultiTexCoord1sPROC) (GLenum target, GLshort s ); 150 | typedef void (APIENTRY *glMultiTexCoord1svPROC) (GLenum target, const GLshort *v ); 151 | typedef void (APIENTRY *glMultiTexCoord2dPROC) (GLenum target, GLdouble s, GLdouble t ); 152 | typedef void (APIENTRY *glMultiTexCoord2dvPROC) (GLenum target, const GLdouble *v ); 153 | typedef void (APIENTRY *glMultiTexCoord2fPROC) (GLenum target, GLfloat s, GLfloat t ); 154 | typedef void (APIENTRY *glMultiTexCoord2fvPROC) (GLenum target, const GLfloat *v ); 155 | typedef void (APIENTRY *glMultiTexCoord2iPROC) (GLenum target, GLint s, GLint t ); 156 | typedef void (APIENTRY *glMultiTexCoord2ivPROC) (GLenum target, const GLint *v ); 157 | typedef void (APIENTRY *glMultiTexCoord2sPROC) (GLenum target, GLshort s, GLshort t ); 158 | typedef void (APIENTRY *glMultiTexCoord2svPROC) (GLenum target, const GLshort *v ); 159 | typedef void (APIENTRY *glMultiTexCoord3dPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r ); 160 | typedef void (APIENTRY *glMultiTexCoord3dvPROC) (GLenum target, const GLdouble *v ); 161 | typedef void (APIENTRY *glMultiTexCoord3fPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r ); 162 | typedef void (APIENTRY *glMultiTexCoord3fvPROC) (GLenum target, const GLfloat *v ); 163 | typedef void (APIENTRY *glMultiTexCoord3iPROC) (GLenum target, GLint s, GLint t, GLint r ); 164 | typedef void (APIENTRY *glMultiTexCoord3ivPROC) (GLenum target, const GLint *v ); 165 | typedef void (APIENTRY *glMultiTexCoord3sPROC) (GLenum target, GLshort s, GLshort t, GLshort r ); 166 | typedef void (APIENTRY *glMultiTexCoord3svPROC) (GLenum target, const GLshort *v ); 167 | typedef void (APIENTRY *glMultiTexCoord4dPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ); 168 | typedef void (APIENTRY *glMultiTexCoord4dvPROC) (GLenum target, const GLdouble *v ); 169 | typedef void (APIENTRY *glMultiTexCoord4fPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ); 170 | typedef void (APIENTRY *glMultiTexCoord4fvPROC) (GLenum target, const GLfloat *v ); 171 | typedef void (APIENTRY *glMultiTexCoord4iPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q ); 172 | typedef void (APIENTRY *glMultiTexCoord4ivPROC) (GLenum target, const GLint *v ); 173 | typedef void (APIENTRY *glMultiTexCoord4sPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ); 174 | typedef void (APIENTRY *glMultiTexCoord4svPROC) (GLenum target, const GLshort *v ); 175 | 176 | ////////////// 177 | //OpenGL 1.4 178 | /////////////// 179 | 180 | #define GL_GENERATE_MIPMAP 0x8191 181 | #define GL_GENERATE_MIPMAP_HINT 0x8192 182 | #define GL_DEPTH_COMPONENT16 0x81A5 183 | #define GL_DEPTH_COMPONENT24 0x81A6 184 | #define GL_DEPTH_COMPONENT32 0x81A7 185 | 186 | ////////////////// 187 | //EXT_framebuffer_object 188 | ////////////////// 189 | 190 | #define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 191 | #define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 192 | #define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 193 | #define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 194 | #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 195 | #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 196 | #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 197 | #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 198 | #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 199 | #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 200 | #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 201 | #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 202 | #define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8 203 | #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 204 | #define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA 205 | #define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB 206 | #define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC 207 | #define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD 208 | #define GL_FRAMEBUFFER_STATUS_ERROR_EXT 0x8CDE 209 | #define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF 210 | #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 211 | #define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 212 | #define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 213 | #define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 214 | #define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 215 | #define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 216 | #define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 217 | #define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 218 | #define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 219 | #define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 220 | #define GL_COLOR_ATTACHMENT10_EXT 0x8CEA 221 | #define GL_COLOR_ATTACHMENT11_EXT 0x8CEB 222 | #define GL_COLOR_ATTACHMENT12_EXT 0x8CEC 223 | #define GL_COLOR_ATTACHMENT13_EXT 0x8CED 224 | #define GL_COLOR_ATTACHMENT14_EXT 0x8CEE 225 | #define GL_COLOR_ATTACHMENT15_EXT 0x8CEF 226 | #define GL_DEPTH_ATTACHMENT_EXT 0x8D00 227 | #define GL_STENCIL_ATTACHMENT_EXT 0x8D20 228 | #define GL_FRAMEBUFFER_EXT 0x8D40 229 | #define GL_RENDERBUFFER_EXT 0x8D41 230 | #define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 231 | #define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 232 | #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 233 | #define GL_STENCIL_INDEX_EXT 0x8D45 234 | #define GL_STENCIL_INDEX1_EXT 0x8D46 235 | #define GL_STENCIL_INDEX4_EXT 0x8D47 236 | #define GL_STENCIL_INDEX8_EXT 0x8D48 237 | #define GL_STENCIL_INDEX16_EXT 0x8D49 238 | 239 | typedef void (APIENTRY *glBindFramebufferEXTPROC) (GLenum target, GLuint framebuffer); 240 | typedef void (APIENTRY *glBindRenderbufferEXTPROC) (GLenum target, GLuint renderbuffer); 241 | typedef GLenum (APIENTRY *glCheckFramebufferStatusEXTPROC) (GLenum target); 242 | typedef void (APIENTRY *glDeleteFramebuffersEXTPROC) (GLsizei n, const GLuint* framebuffers); 243 | typedef void (APIENTRY *glDeleteRenderBuffersEXTPROC) (GLsizei n, const GLuint* renderbuffers); 244 | typedef void (APIENTRY *glFramebufferRenderbufferEXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); 245 | typedef void (APIENTRY *glFramebufferTexture1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); 246 | typedef void (APIENTRY *glFramebufferTexture2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); 247 | typedef void (APIENTRY *glFramebufferTexture3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); 248 | typedef void (APIENTRY *glGenFramebuffersEXTPROC) (GLsizei n, GLuint* framebuffers); 249 | typedef void (APIENTRY *glGenRenderbuffersEXTPROC) (GLsizei n, GLuint* renderbuffers); 250 | typedef void (APIENTRY *glGenerateMipmapEXTPROC) (GLenum target); 251 | typedef void (APIENTRY *glGetFramebufferAttachmentParameterivEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); 252 | typedef void (APIENTRY *glGetRenderbufferParameterivEXTPROC) (GLenum target, GLenum pname, GLint* params); 253 | typedef GLboolean (APIENTRY *glIsFramebufferEXTPROC) (GLuint framebuffer); 254 | typedef GLboolean (APIENTRY *glIsRenderbufferEXTPROC) (GLuint renderbuffer); 255 | typedef void (APIENTRY *glRenderbufferStorageEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); 256 | 257 | 258 | ////////////////////// 259 | //EXT_TEXTURE_RECTANGLE 260 | //(#'s are the same as NV_TEXTURE_RECTANGLE and ARB_TEXTURE_RECTANGLE) 261 | /////////////////////// 262 | #define GL_TEXTURE_RECTANGLE_EXT 0x84F5 263 | #define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6 264 | #define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7 265 | #define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8 266 | 267 | 268 | /////////////////////// 269 | // GL_ARB_shader_objects 270 | /////////////////////// 271 | #define GL_FRAGMENT_SHADER_ARB 0x8B30 272 | #define GL_VERTEX_SHADER_ARB 0x8B31 273 | #define GL_PROGRAM_OBJECT_ARB 0x8B40 274 | #define GL_SHADER_OBJECT_ARB 0x8B48 275 | #define GL_OBJECT_TYPE_ARB 0x8B4E 276 | #define GL_OBJECT_SUBTYPE_ARB 0x8B4F 277 | #define GL_FLOAT_VEC2_ARB 0x8B50 278 | #define GL_FLOAT_VEC3_ARB 0x8B51 279 | #define GL_FLOAT_VEC4_ARB 0x8B52 280 | #define GL_INT_VEC2_ARB 0x8B53 281 | #define GL_INT_VEC3_ARB 0x8B54 282 | #define GL_INT_VEC4_ARB 0x8B55 283 | #define GL_BOOL_ARB 0x8B56 284 | #define GL_BOOL_VEC2_ARB 0x8B57 285 | #define GL_BOOL_VEC3_ARB 0x8B58 286 | #define GL_BOOL_VEC4_ARB 0x8B59 287 | #define GL_FLOAT_MAT2_ARB 0x8B5A 288 | #define GL_FLOAT_MAT3_ARB 0x8B5B 289 | #define GL_FLOAT_MAT4_ARB 0x8B5C 290 | #define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 291 | #define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 292 | #define GL_OBJECT_LINK_STATUS_ARB 0x8B82 293 | #define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 294 | #define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 295 | #define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 296 | #define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 297 | #define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 298 | #define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 299 | 300 | /* GL types for handling shader object handles and characters */ 301 | typedef char GLcharARB; /* native character */ 302 | typedef unsigned int GLhandleARB; /* shader object handle */ 303 | 304 | typedef void (APIENTRY * glDeleteObjectARBPROC) (GLhandleARB); 305 | typedef GLhandleARB (APIENTRY * glGetHandleARBPROC) (GLenum); 306 | typedef void (APIENTRY * glDetachObjectARBPROC) (GLhandleARB, GLhandleARB); 307 | typedef GLhandleARB (APIENTRY * glCreateShaderObjectARBPROC) (GLenum); 308 | typedef void (APIENTRY * glShaderSourceARBPROC) (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); 309 | typedef void (APIENTRY * glCompileShaderARBPROC) (GLhandleARB); 310 | typedef GLhandleARB (APIENTRY * glCreateProgramObjectARBPROC) (void); 311 | typedef void (APIENTRY * glAttachObjectARBPROC) (GLhandleARB, GLhandleARB); 312 | typedef void (APIENTRY * glLinkProgramARBPROC) (GLhandleARB); 313 | typedef void (APIENTRY * glUseProgramObjectARBPROC) (GLhandleARB); 314 | typedef void (APIENTRY * glValidateProgramARBPROC) (GLhandleARB); 315 | typedef void (APIENTRY * glUniform1fARBPROC) (GLint, GLfloat); 316 | typedef void (APIENTRY * glUniform2fARBPROC) (GLint, GLfloat, GLfloat); 317 | typedef void (APIENTRY * glUniform3fARBPROC) (GLint, GLfloat, GLfloat, GLfloat); 318 | typedef void (APIENTRY * glUniform4fARBPROC) (GLint, GLfloat, GLfloat, GLfloat, GLfloat); 319 | typedef void (APIENTRY * glUniform1iARBPROC) (GLint, GLint); 320 | typedef void (APIENTRY * glUniform2iARBPROC) (GLint, GLint, GLint); 321 | typedef void (APIENTRY * glUniform3iARBPROC) (GLint, GLint, GLint, GLint); 322 | typedef void (APIENTRY * glUniform4iARBPROC) (GLint, GLint, GLint, GLint, GLint); 323 | typedef void (APIENTRY * glUniform1fvARBPROC) (GLint, GLsizei, const GLfloat *); 324 | typedef void (APIENTRY * glUniform2fvARBPROC) (GLint, GLsizei, const GLfloat *); 325 | typedef void (APIENTRY * glUniform3fvARBPROC) (GLint, GLsizei, const GLfloat *); 326 | typedef void (APIENTRY * glUniform4fvARBPROC) (GLint, GLsizei, const GLfloat *); 327 | typedef void (APIENTRY * glUniform1ivARBPROC) (GLint, GLsizei, const GLint *); 328 | typedef void (APIENTRY * glUniform2ivARBPROC) (GLint, GLsizei, const GLint *); 329 | typedef void (APIENTRY * glUniform3ivARBPROC) (GLint, GLsizei, const GLint *); 330 | typedef void (APIENTRY * glUniform4ivARBPROC) (GLint, GLsizei, const GLint *); 331 | typedef void (APIENTRY * glUniformMatrix2fvARBPROC) (GLint, GLsizei, GLboolean, const GLfloat *); 332 | typedef void (APIENTRY * glUniformMatrix3fvARBPROC) (GLint, GLsizei, GLboolean, const GLfloat *); 333 | typedef void (APIENTRY * glUniformMatrix4fvARBPROC) (GLint, GLsizei, GLboolean, const GLfloat *); 334 | typedef void (APIENTRY * glGetObjectParameterfvARBPROC) (GLhandleARB, GLenum, GLfloat *); 335 | typedef void (APIENTRY * glGetObjectParameterivARBPROC) (GLhandleARB, GLenum, GLint *); 336 | typedef void (APIENTRY * glGetInfoLogARBPROC) (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); 337 | typedef void (APIENTRY * glGetAttachedObjectsARBPROC) (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); 338 | typedef GLint (APIENTRY * glGetUniformLocationARBPROC) (GLhandleARB, const GLcharARB *); 339 | typedef void (APIENTRY * glGetActiveUniformARBPROC) (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); 340 | typedef void (APIENTRY * glGetUniformfvARBPROC) (GLhandleARB, GLint, GLfloat *); 341 | typedef void (APIENTRY * glGetUniformivARBPROC) (GLhandleARB, GLint, GLint *); 342 | typedef void (APIENTRY * glGetShaderSourceARBPROC) (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); 343 | 344 | #ifdef _WIN32 345 | 346 | ////////////////// 347 | //WGL_EXT_SWAP_CONTROL 348 | ////////////////// 349 | typedef BOOL (APIENTRY *wglSwapIntervalEXTPROC) (int interval); 350 | typedef int (APIENTRY *wglGetSwapIntervalEXTPROC) (void); 351 | 352 | #endif 353 | 354 | ///////////////////////////////////////////////////// 355 | /////////////// 356 | //classes to handle extensions 357 | /////////////// 358 | ///////////////////////////////////////////////////// 359 | 360 | class FFGLExtensions 361 | { 362 | public: 363 | FFGLExtensions(); 364 | 365 | void Initialize(); 366 | 367 | //Multitexture 368 | int multitexture; 369 | glActiveTexturePROC glActiveTexture; 370 | glClientActiveTexturePROC glClientActiveTexture; 371 | glMultiTexCoord1dPROC glMultiTexCoord1d; 372 | glMultiTexCoord1dvPROC glMultiTexCoord1dv; 373 | glMultiTexCoord1fPROC glMultiTexCoord1f; 374 | glMultiTexCoord1fvPROC glMultiTexCoord1fv; 375 | glMultiTexCoord1iPROC glMultiTexCoord1i; 376 | glMultiTexCoord1ivPROC glMultiTexCoord1iv; 377 | glMultiTexCoord1sPROC glMultiTexCoord1s; 378 | glMultiTexCoord1svPROC glMultiTexCoord1sv; 379 | glMultiTexCoord2dPROC glMultiTexCoord2d; 380 | glMultiTexCoord2dvPROC glMultiTexCoord2dv; 381 | glMultiTexCoord2fPROC glMultiTexCoord2f; 382 | glMultiTexCoord2fvPROC glMultiTexCoord2fv; 383 | glMultiTexCoord2iPROC glMultiTexCoord2i; 384 | glMultiTexCoord2ivPROC glMultiTexCoord2iv; 385 | glMultiTexCoord2sPROC glMultiTexCoord2s; 386 | glMultiTexCoord2svPROC glMultiTexCoord2sv; 387 | glMultiTexCoord3dPROC glMultiTexCoord3d; 388 | glMultiTexCoord3dvPROC glMultiTexCoord3dv; 389 | glMultiTexCoord3fPROC glMultiTexCoord3f; 390 | glMultiTexCoord3fvPROC glMultiTexCoord3fv; 391 | glMultiTexCoord3iPROC glMultiTexCoord3i; 392 | glMultiTexCoord3ivPROC glMultiTexCoord3iv; 393 | glMultiTexCoord3sPROC glMultiTexCoord3s; 394 | glMultiTexCoord3svPROC glMultiTexCoord3sv; 395 | glMultiTexCoord4dPROC glMultiTexCoord4d; 396 | glMultiTexCoord4dvPROC glMultiTexCoord4dv; 397 | glMultiTexCoord4fPROC glMultiTexCoord4f; 398 | glMultiTexCoord4fvPROC glMultiTexCoord4fv; 399 | glMultiTexCoord4iPROC glMultiTexCoord4i; 400 | glMultiTexCoord4ivPROC glMultiTexCoord4iv; 401 | glMultiTexCoord4sPROC glMultiTexCoord4s; 402 | glMultiTexCoord4svPROC glMultiTexCoord4sv; 403 | 404 | //ARB_shader_objects 405 | int ARB_shader_objects; 406 | glDeleteObjectARBPROC glDeleteObjectARB; 407 | glGetHandleARBPROC glGetHandleARB; 408 | glDetachObjectARBPROC glDetachObjectARB; 409 | glCreateShaderObjectARBPROC glCreateShaderObjectARB; 410 | glShaderSourceARBPROC glShaderSourceARB; 411 | glCompileShaderARBPROC glCompileShaderARB; 412 | glCreateProgramObjectARBPROC glCreateProgramObjectARB; 413 | glAttachObjectARBPROC glAttachObjectARB; 414 | glLinkProgramARBPROC glLinkProgramARB; 415 | glUseProgramObjectARBPROC glUseProgramObjectARB; 416 | glValidateProgramARBPROC glValidateProgramARB; 417 | glUniform1fARBPROC glUniform1fARB; 418 | glUniform2fARBPROC glUniform2fARB; 419 | glUniform3fARBPROC glUniform3fARB; 420 | glUniform4fARBPROC glUniform4fARB; 421 | glUniform1iARBPROC glUniform1iARB; 422 | glUniform2iARBPROC glUniform2iARB; 423 | glUniform3iARBPROC glUniform3iARB; 424 | glUniform4iARBPROC glUniform4iARB; 425 | glUniform1fvARBPROC glUniform1fvARB; 426 | glUniform2fvARBPROC glUniform2fvARB; 427 | glUniform3fvARBPROC glUniform3fvARB; 428 | glUniform4fvARBPROC glUniform4fvARB; 429 | glUniform1ivARBPROC glUniform1ivARB; 430 | glUniform2ivARBPROC glUniform2ivARB; 431 | glUniform3ivARBPROC glUniform3ivARB; 432 | glUniform4ivARBPROC glUniform4ivARB; 433 | glUniformMatrix2fvARBPROC glUniformMatrix2fvARB; 434 | glUniformMatrix3fvARBPROC glUniformMatrix3fvARB; 435 | glUniformMatrix4fvARBPROC glUniformMatrix4fvARB; 436 | glGetObjectParameterfvARBPROC glGetObjectParameterfvARB; 437 | glGetObjectParameterivARBPROC glGetObjectParameterivARB; 438 | glGetInfoLogARBPROC glGetInfoLogARB; 439 | glGetAttachedObjectsARBPROC glGetAttachedObjectsARB; 440 | glGetUniformLocationARBPROC glGetUniformLocationARB; 441 | glGetActiveUniformARBPROC glGetActiveUniformARB; 442 | glGetUniformfvARBPROC glGetUniformfvARB; 443 | glGetUniformivARBPROC glGetUniformivARB; 444 | glGetShaderSourceARBPROC glGetShaderSourceARB; 445 | 446 | //EXT_framebuffer_object 447 | int EXT_framebuffer_object; 448 | glBindFramebufferEXTPROC glBindFramebufferEXT; 449 | glBindRenderbufferEXTPROC glBindRenderbufferEXT; 450 | glCheckFramebufferStatusEXTPROC glCheckFramebufferStatusEXT; 451 | glDeleteFramebuffersEXTPROC glDeleteFramebuffersEXT; 452 | glDeleteRenderBuffersEXTPROC glDeleteRenderBuffersEXT; 453 | glFramebufferRenderbufferEXTPROC glFramebufferRenderbufferEXT; 454 | glFramebufferTexture1DEXTPROC glFramebufferTexture1DEXT; 455 | glFramebufferTexture2DEXTPROC glFramebufferTexture2DEXT; 456 | glFramebufferTexture3DEXTPROC glFramebufferTexture3DEXT; 457 | glGenFramebuffersEXTPROC glGenFramebuffersEXT; 458 | glGenRenderbuffersEXTPROC glGenRenderbuffersEXT; 459 | glGenerateMipmapEXTPROC glGenerateMipmapEXT; 460 | glGetFramebufferAttachmentParameterivEXTPROC glGetFramebufferAttachmentParameterivEXT; 461 | glGetRenderbufferParameterivEXTPROC glGetRenderbufferParameterivEXT; 462 | glIsFramebufferEXTPROC glIsFramebufferEXT; 463 | glIsRenderbufferEXTPROC glIsRenderbufferEXT; 464 | glRenderbufferStorageEXTPROC glRenderbufferStorageEXT; 465 | 466 | #ifdef _WIN32 467 | int WGL_EXT_swap_control; 468 | wglSwapIntervalEXTPROC wglSwapIntervalEXT; 469 | wglGetSwapIntervalEXTPROC wglGetSwapIntervalEXT; 470 | #endif 471 | 472 | private: 473 | void *GetProcAddress(char *); 474 | 475 | void InitMultitexture(); 476 | void InitARBShaderObjects(); 477 | void InitEXTFramebufferObject(); 478 | 479 | #ifdef _WIN32 480 | void InitWGLEXTSwapControl(); 481 | #endif 482 | }; 483 | 484 | #endif 485 | -------------------------------------------------------------------------------- /FFGL/FFGLFBO.h: -------------------------------------------------------------------------------- 1 | #ifndef FFGLFBO_H 2 | #define FFGLFBO_H 3 | 4 | #include 5 | #include 6 | 7 | class FFGLFBO 8 | { 9 | public: 10 | FFGLFBO() 11 | :m_width(0), 12 | m_height(0), 13 | m_glWidth(0), 14 | m_glHeight(0), 15 | m_glPixelFormat(0), 16 | m_glTextureTarget(0), 17 | m_glTextureHandle(0), 18 | m_fboHandle(0), 19 | m_depthBufferHandle(0) 20 | {} 21 | 22 | int Create(int width, int height, FFGLExtensions &e); 23 | int BindAsRenderTarget(FFGLExtensions &e); 24 | int UnbindAsRenderTarget(FFGLExtensions &e); 25 | 26 | FFGLTextureStruct GetTextureInfo(); 27 | 28 | void FreeResources(FFGLExtensions &e); 29 | 30 | GLuint GetWidth() { return m_width; } 31 | GLuint GetHeight() { return m_height; } 32 | GLuint GetFBOHandle() { return m_fboHandle; } 33 | 34 | protected: 35 | GLuint m_width; 36 | GLuint m_height; 37 | GLuint m_glWidth; 38 | GLuint m_glHeight; 39 | GLuint m_glPixelFormat; 40 | GLuint m_glTextureTarget; 41 | GLuint m_glTextureHandle; 42 | GLuint m_fboHandle; 43 | GLuint m_depthBufferHandle; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /FFGL/FFGLLib.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // FFGLLib.h 3 | // 4 | // FreeFrame is an open-source cross-platform real-time video effects plugin system. 5 | // It provides a framework for developing video effects plugins and hosts on Windows, 6 | // Linux and Mac OSX. 7 | // 8 | // Copyright (c) 2006 www.freeframe.org 9 | // All rights reserved. 10 | // 11 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 12 | 13 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 14 | // FFGLLib.h by Trey Harrison 15 | // www.harrisondigitalmedia.com 16 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 17 | 18 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 19 | // 20 | // Redistribution and use in source and binary forms, with or without modification, 21 | // are permitted provided that the following conditions are met: 22 | // 23 | // * Redistributions of source code must retain the above copyright 24 | // notice, this list of conditions and the following disclaimer. 25 | // * Redistributions in binary form must reproduce the above copyright 26 | // notice, this list of conditions and the following disclaimer in 27 | // the documentation and/or other materials provided with the 28 | // distribution. 29 | // * Neither the name of FreeFrame nor the names of its 30 | // contributors may be used to endorse or promote products derived 31 | // from this software without specific prior written permission. 32 | // 33 | // 34 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 35 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 36 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 37 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 38 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 39 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 40 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 41 | // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 42 | // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 43 | // OF THE POSSIBILITY OF SUCH DAMAGE. 44 | // 45 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 46 | 47 | #ifndef __FFGLLIB_H__ 48 | #define __FFGLLIB_H__ 49 | 50 | //FFGLTexCoords 51 | typedef struct FFGLTexCoordsTag 52 | { 53 | GLdouble s,t; 54 | } FFGLTexCoords; 55 | 56 | //helper function to return the s,t,r coordinate 57 | //that cooresponds to the width,height,depth of the used 58 | //portion of the texture 59 | inline FFGLTexCoords GetMaxGLTexCoords(FFGLTextureStruct t) 60 | { 61 | FFGLTexCoords texCoords; 62 | 63 | //the texture may only occupy a portion 64 | //of the allocated hardware texture memory 65 | 66 | //normalized (0..1) S and T coords 67 | texCoords.s = ((GLdouble)t.Width) / (GLdouble)t.HardwareWidth; 68 | texCoords.t = ((GLdouble)t.Height) / (GLdouble)t.HardwareHeight; 69 | 70 | return texCoords; 71 | } 72 | 73 | #endif -------------------------------------------------------------------------------- /FFGL/FFGLPluginInfo.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 - InfoMus Lab - DIST - University of Genova 3 | // 4 | // InfoMus Lab (Laboratorio di Informatica Musicale) 5 | // DIST - University of Genova 6 | // 7 | // http://www.infomus.dist.unige.it 8 | // news://infomus.dist.unige.it 9 | // mailto:staff@infomus.dist.unige.it 10 | // 11 | // Developer: Gualtiero Volpe 12 | // mailto:volpe@infomus.dist.unige.it 13 | // 14 | // Last modified: 2004-11-10 15 | // 16 | 17 | #include "FFGLPluginInfo.h" 18 | 19 | #include 20 | #include 21 | 22 | extern CFFGLPluginInfo* g_CurrPluginInfo; 23 | 24 | 25 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 26 | // CFFGLPluginInfo constructor and destructor 27 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 28 | 29 | CFFGLPluginInfo::CFFGLPluginInfo( 30 | FPCREATEINSTANCEGL* pCreateInstance, 31 | const char* pchUniqueID, 32 | const char* pchPluginName, 33 | DWORD dwAPIMajorVersion, 34 | DWORD dwAPIMinorVersion, 35 | DWORD dwPluginMajorVersion, 36 | DWORD dwPluginMinorVersion, 37 | DWORD dwPluginType, 38 | const char* pchDescription, 39 | const char* pchAbout, 40 | DWORD dwFreeFrameExtendedDataSize, 41 | const void* pFreeFrameExtendedDataBlock 42 | ) 43 | { 44 | m_pCreateInstance = pCreateInstance; 45 | 46 | // Filling PluginInfoStruct 47 | m_PluginInfo.APIMajorVersion = dwAPIMajorVersion; 48 | m_PluginInfo.APIMinorVersion = dwAPIMinorVersion; 49 | 50 | bool bEndFound = false; 51 | for (int i = 0; (i < 16) && (!bEndFound); ++i) { 52 | if (pchPluginName[i] == 0) bEndFound = true; 53 | (m_PluginInfo.PluginName)[i] = (bEndFound) ? 0 : pchPluginName[i]; 54 | } 55 | 56 | bEndFound = false; 57 | for (int j = 0; (j < 4) && (!bEndFound); ++j) { 58 | if (pchUniqueID[j] == 0) bEndFound = true; 59 | (m_PluginInfo.PluginUniqueID)[j] = (bEndFound) ? 0 : pchUniqueID[j]; 60 | } 61 | 62 | m_PluginInfo.PluginType = dwPluginType; 63 | 64 | // Filling PluginExtendedInfoStruct 65 | m_PluginExtendedInfo.About = strdup(pchAbout); 66 | m_PluginExtendedInfo.Description = strdup(pchDescription); 67 | m_PluginExtendedInfo.PluginMajorVersion = dwPluginMajorVersion; 68 | m_PluginExtendedInfo.PluginMinorVersion = dwPluginMinorVersion; 69 | if ((dwFreeFrameExtendedDataSize > 0) && (pFreeFrameExtendedDataBlock != NULL)) { 70 | memcpy(m_PluginExtendedInfo.FreeFrameExtendedDataBlock, pFreeFrameExtendedDataBlock, dwFreeFrameExtendedDataSize); 71 | m_PluginExtendedInfo.FreeFrameExtendedDataSize = dwFreeFrameExtendedDataSize; 72 | } 73 | else { 74 | m_PluginExtendedInfo.FreeFrameExtendedDataBlock = NULL; 75 | m_PluginExtendedInfo.FreeFrameExtendedDataSize = 0; 76 | } 77 | 78 | g_CurrPluginInfo = this; 79 | } 80 | 81 | CFFGLPluginInfo::~CFFGLPluginInfo() 82 | { 83 | free(m_PluginExtendedInfo.About); 84 | free(m_PluginExtendedInfo.Description); 85 | } 86 | 87 | 88 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 89 | // CFFGLPluginInfo methods 90 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 91 | 92 | const PluginInfoStruct* CFFGLPluginInfo::GetPluginInfo() const 93 | { 94 | return &m_PluginInfo; 95 | } 96 | 97 | const PluginExtendedInfoStruct* CFFGLPluginInfo::GetPluginExtendedInfo() const 98 | { 99 | return &m_PluginExtendedInfo; 100 | } 101 | 102 | FPCREATEINSTANCEGL* CFFGLPluginInfo::GetFactoryMethod() const 103 | { 104 | return m_pCreateInstance; 105 | } 106 | -------------------------------------------------------------------------------- /FFGL/FFGLPluginInfo.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 - InfoMus Lab - DIST - University of Genova 3 | // 4 | // InfoMus Lab (Laboratorio di Informatica Musicale) 5 | // DIST - University of Genova 6 | // 7 | // http://www.infomus.dist.unige.it 8 | // news://infomus.dist.unige.it 9 | // mailto:staff@infomus.dist.unige.it 10 | // 11 | // Developer: Gualtiero Volpe 12 | // mailto:volpe@infomus.dist.unige.it 13 | // 14 | // Developer: Trey Harrison 15 | // www.harrisondigitalmedia.com 16 | // 17 | // Last modified: Oct. 26 2006 18 | // 19 | 20 | #ifndef FFGLPLUGININFO_STANDARD 21 | #define FFGLPLUGININFO_STANDARD 22 | 23 | #include "FFGL.h" 24 | 25 | #ifdef TARGET_OS_MAC 26 | //there is no need for __stdcall on mac, so this will eliminate any 27 | //usage of it 28 | #define __stdcall 29 | #endif 30 | 31 | #ifdef __linux__ 32 | #define __stdcall 33 | #endif 34 | 35 | //FPCREATEINSTANCEGL is a pointer to a function that creates FFGL plugins 36 | //in this SDK, all FFGL plugins must derive from CFreeFrameGLPlugin 37 | typedef DWORD __stdcall FPCREATEINSTANCEGL(class CFreeFrameGLPlugin **ppOutInstance); 38 | 39 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 40 | /// \class CFFGLPluginInfo 41 | /// \brief CFFGLPluginInfo manages static information concerning a plugin name, version, and description. 42 | /// \author Gualtiero Volpe 43 | /// \date 20041110 44 | /// \version 1.0.0.2 45 | /// 46 | /// The CFFGLPluginInfo class manages static information related to a FreeFrameGL plugin. Examples are the name of 47 | /// the plugin, its unique identifier, its type (either source or effect), the current version, the version of 48 | /// the FreeFrame API the plugin refers to, a short description of the plugin, information about the developer(s) 49 | /// and possible copyright. In other words, this class stores the information required by the FreeFrame getInfo 50 | /// and getExtendedInfo global functions. 51 | /// The CFFGLPluginInfo class is also involved in the process of creating an instance of the subclass implementing 52 | /// a plugin: it stores a pointer to the factory method of the plugin subclass, which is called when the plugin 53 | /// object needs to be instantiated. The FreeFrame SDK keeps a prototype instance of the plugin in order to be able 54 | /// to access information on the plugin at any time. The effectively working instance is created at the time the 55 | /// plugin is instantiated by the host. 56 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 57 | 58 | class CFFGLPluginInfo { 59 | 60 | public: 61 | 62 | /// The constructor of CFFGLPluginInfo receives through its parameters the information that needs 63 | /// to be stored. 64 | /// 65 | /// \param pCreateInstance A pointer to the factory method of the subclass implementing 66 | /// the plugin. 67 | /// \param pchUniqueID A string representing the unique identificator of the plugin. 68 | /// According to the FreeFrame specification, it must be a not null 69 | /// terminated string of 4 1-byte ASCII characters. Longer strings will 70 | /// be truncated at the 4th character. 71 | /// \param pchPluginName A string containing the name of the plugin. According to the 72 | /// FreeFrame specification, it must be a not null terminated string 73 | /// of 16 1-byte ASCII characters. Longer strings will be truncated at 74 | /// the 16th character. 75 | /// \param dwAPIMajorVersion The major version number of the FreeFrame API employed by the plugin. 76 | /// It is the number before the decimal point in the API version number. 77 | /// \param dwAPIMinorVersion The minor version number of the FreeFrame API employed by the plugin. 78 | /// It is the number after the decimal point in the API version number. 79 | /// \param dwPluginMajorVersion The major version number of the plugin. It is the number before 80 | /// the decimal point in the plugin version number. 81 | /// \param dwPluginMinorVersion The minor version number of the plugin. It is the number after 82 | /// the decimal point in the plugin version number. 83 | /// \param dwPluginType The type of the plugin. According to the FreeFrame specification, 84 | /// it should be 0 in case of effect plugins and 1 in case of source 85 | /// plugins. 86 | /// \param pchDescription A string providing a short description of what the plugin does. 87 | /// \param pchAbout A string providing information on the developer(s) of the plugin, 88 | /// their possible company, and possible copyright information. 89 | /// \param dwFreeFrameExtendedDataSize Size in bytes of the FreeFrame ExtendedDataBlock, or 0 if not 90 | /// provided by plugin. Extended Data Bloks are not yet exploited 91 | /// in the current version of the FreeFrame specification (1.0). 92 | /// Therefore, at the moment the default value (0) should be used 93 | /// for this parameter. 94 | /// \param pFreeFrameExtendedDataBlock 32-bit pointer to a FreeFrame ExtendedDataBlock, Extended 95 | /// Data Bloks are not yet expolited by the FreeFrame specification 96 | /// version 1.0. Therefore, at the moment the default value (NULL) 97 | /// should be used for this parameter 98 | CFFGLPluginInfo( 99 | FPCREATEINSTANCEGL* pCreateInstance, 100 | const char* pchUniqueID, 101 | const char* pchPluginName, 102 | DWORD dwAPIMajorVersion, 103 | DWORD dwAPIMinorVersion, 104 | DWORD dwPluginMajorVersion, 105 | DWORD dwPluginMinorVersion, 106 | DWORD dwPluginType, 107 | const char* pchDescription, 108 | const char* pchAbout, 109 | DWORD dwFreeFrameExtendedDataSize = 0, 110 | const void* pFreeFrameExtendedDataBlock = NULL 111 | ); 112 | 113 | /// The standard destructor of CFFGLPluginInfo. 114 | ~CFFGLPluginInfo(); 115 | 116 | /// This method returns a pointer to a PluginInfoStruct as defined in FreeFrame.h. Such structure 117 | /// contains information on the plugin name and type, its unique identifier, and the version of the 118 | /// FreeFrame API it uses. 119 | /// 120 | /// \return A pointer to a PluginInfoStruct containing information on the plugin. For further 121 | /// information on the definition of PluginInfoStruct see the header file FreeFrame.h and 122 | /// the FreeFrame specification version 1.0. 123 | const PluginInfoStruct* GetPluginInfo() const; 124 | 125 | /// This method returns a pointer to a PluginExtendedInfoStruct (for further information see 126 | /// FreeFrame.h and the FreeFrame specification). A PluginExtendedInfoStruct contains information on 127 | /// the plugin version, a short description of the plugin, and information about the developer(s) and 128 | /// possible copyright issues. 129 | /// 130 | /// \return A pointer to a PluginExtendedInfoStruct containing information on the plugin. 131 | /// For further information on the definition PluginExtendedInfoStruct see the header file 132 | /// FreeFrame.h and the FreeFrame specification version 1.0. 133 | const PluginExtendedInfoStruct* GetPluginExtendedInfo() const; 134 | 135 | /// This method returns a pointer to the factory method of the subclass implementing the plugin. It is 136 | /// called by the FreeFrame SDK when creating a new instance of the plugin. 137 | /// 138 | /// \return A pointer to the factory method of the plugin subclass. 139 | FPCREATEINSTANCEGL* GetFactoryMethod() const; 140 | 141 | private: 142 | 143 | // Structures containing information about the plugin 144 | PluginInfoStruct m_PluginInfo; 145 | PluginExtendedInfoStruct m_PluginExtendedInfo; 146 | 147 | // Pointer to the factory method of the plugin subclass 148 | FPCREATEINSTANCEGL* m_pCreateInstance; 149 | }; 150 | 151 | 152 | #endif 153 | -------------------------------------------------------------------------------- /FFGL/FFGLPluginInfoData.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // FFGLPluginInfoData.cpp 3 | // 4 | // Usually you do not need to edit this file! 5 | // 6 | 7 | #include "FFGLPluginInfo.h" 8 | 9 | 10 | ////////////////////////////////////////////////////////////////// 11 | // Information about the plugin 12 | ////////////////////////////////////////////////////////////////// 13 | 14 | CFFGLPluginInfo* g_CurrPluginInfo = NULL; 15 | 16 | 17 | ////////////////////////////////////////////////////////////////// 18 | // Plugin dll entry point 19 | ////////////////////////////////////////////////////////////////// 20 | #ifdef _WIN32 21 | BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) 22 | { 23 | return TRUE; 24 | } 25 | #endif 26 | -------------------------------------------------------------------------------- /FFGL/FFGLPluginManager.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 - InfoMus Lab - DIST - University of Genova 3 | // 4 | // InfoMus Lab (Laboratorio di Informatica Musicale) 5 | // DIST - University of Genova 6 | // 7 | // http://www.infomus.dist.unige.it 8 | // news://infomus.dist.unige.it 9 | // mailto:staff@infomus.dist.unige.it 10 | // 11 | // Developer: Gualtiero Volpe 12 | // mailto:volpe@infomus.dist.unige.it 13 | // 14 | // Last modified: Oct 25 2006 by Trey Harrison 15 | // email:trey@harrisondigitalmedia.com 16 | 17 | #include "FFGLPluginManager.h" 18 | #include "FFGLPluginSDK.h" 19 | 20 | #include 21 | #include 22 | 23 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 24 | // CFFGLPluginManager constructor and destructor 25 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 26 | 27 | CFFGLPluginManager::CFFGLPluginManager() 28 | { 29 | m_iMinInputs = 0; 30 | m_iMaxInputs = 0; 31 | m_timeSupported = 0; 32 | 33 | m_NParams = 0; 34 | m_pFirst = NULL; 35 | m_pLast = NULL; 36 | } 37 | 38 | CFFGLPluginManager::~CFFGLPluginManager() 39 | { 40 | if (m_pFirst != NULL) 41 | { 42 | ParamInfo* pCurr = m_pFirst; 43 | ParamInfo* pNext = m_pFirst; 44 | 45 | while (pCurr != NULL) 46 | { 47 | pNext = pCurr->pNext; 48 | 49 | if ( (pCurr->dwType == FF_TYPE_TEXT) && 50 | (pCurr->StrDefaultValue != NULL) ) 51 | { 52 | free(pCurr->StrDefaultValue); 53 | } 54 | 55 | delete pCurr; 56 | pCurr = pNext; 57 | } 58 | } 59 | 60 | m_pFirst = NULL; 61 | m_pLast = NULL; 62 | } 63 | 64 | 65 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 66 | // CFFGLPluginManager methods 67 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 68 | void CFFGLPluginManager::SetMinInputs(int iMinInputs) 69 | { 70 | m_iMinInputs = iMinInputs; 71 | } 72 | 73 | void CFFGLPluginManager::SetMaxInputs(int iMaxInputs) 74 | { 75 | m_iMaxInputs = iMaxInputs; 76 | } 77 | 78 | void CFFGLPluginManager::SetParamInfo(DWORD dwIndex, const char* pchName, DWORD dwType, float fDefaultValue) 79 | { 80 | ParamInfo* pInfo = new ParamInfo; 81 | pInfo->ID = dwIndex; 82 | 83 | bool bEndFound = false; 84 | for (int i = 0; i < 16; ++i) { 85 | if (pchName[i] == 0) bEndFound = true; 86 | pInfo->Name[i] = (bEndFound) ? 0 : pchName[i]; 87 | } 88 | 89 | pInfo->dwType = dwType; 90 | if (fDefaultValue > 1.0) fDefaultValue = 1.0; 91 | if (fDefaultValue < 0.0) fDefaultValue = 0.0; 92 | pInfo->DefaultValue = fDefaultValue; 93 | pInfo->StrDefaultValue = NULL; 94 | pInfo->pNext = NULL; 95 | if (m_pFirst == NULL) m_pFirst = pInfo; 96 | if (m_pLast != NULL) m_pLast->pNext = pInfo; 97 | m_pLast = pInfo; 98 | m_NParams++; 99 | } 100 | 101 | void CFFGLPluginManager::SetParamInfo(DWORD dwIndex, const char* pchName, DWORD dwType, bool bDefaultValue) 102 | { 103 | ParamInfo* pInfo = new ParamInfo; 104 | pInfo->ID = dwIndex; 105 | 106 | bool bEndFound = false; 107 | for (int i = 0; i < 16; ++i) { 108 | if (pchName[i] == 0) bEndFound = true; 109 | pInfo->Name[i] = (bEndFound) ? 0 : pchName[i]; 110 | } 111 | 112 | pInfo->dwType = dwType; 113 | pInfo->DefaultValue = bDefaultValue ? 1.0f : 0.0f; 114 | pInfo->StrDefaultValue = NULL; 115 | pInfo->pNext = NULL; 116 | if (m_pFirst == NULL) m_pFirst = pInfo; 117 | if (m_pLast != NULL) m_pLast->pNext = pInfo; 118 | m_pLast = pInfo; 119 | m_NParams++; 120 | } 121 | 122 | void CFFGLPluginManager::SetParamInfo(DWORD dwIndex, const char* pchName, DWORD dwType, const char* pchDefaultValue) 123 | { 124 | ParamInfo* pInfo = new ParamInfo; 125 | pInfo->ID = dwIndex; 126 | 127 | bool bEndFound = false; 128 | for (int i = 0; i < 16; ++i) { 129 | if (pchName[i] == 0) bEndFound = true; 130 | pInfo->Name[i] = (bEndFound) ? 0 : pchName[i]; 131 | } 132 | 133 | pInfo->dwType = dwType; 134 | pInfo->DefaultValue = 0; 135 | pInfo->StrDefaultValue = strdup(pchDefaultValue); 136 | pInfo->pNext = NULL; 137 | if (m_pFirst == NULL) m_pFirst = pInfo; 138 | if (m_pLast != NULL) m_pLast->pNext = pInfo; 139 | m_pLast = pInfo; 140 | m_NParams++; 141 | } 142 | 143 | void CFFGLPluginManager::SetTimeSupported(bool supported) 144 | { 145 | m_timeSupported = supported; 146 | } 147 | 148 | char* CFFGLPluginManager::GetParamName(DWORD dwIndex) const 149 | { 150 | ParamInfo* pCurr = m_pFirst; 151 | bool bFound = false; 152 | while (pCurr != NULL) { 153 | if (pCurr->ID == dwIndex) { 154 | bFound = true; 155 | break; 156 | } 157 | pCurr = pCurr->pNext; 158 | } 159 | if (bFound) return pCurr->Name; 160 | return NULL; 161 | } 162 | 163 | DWORD CFFGLPluginManager::GetParamType(DWORD dwIndex) const 164 | { 165 | ParamInfo* pCurr = m_pFirst; 166 | bool bFound = false; 167 | while (pCurr != NULL) { 168 | if (pCurr->ID == dwIndex) { 169 | bFound = true; 170 | break; 171 | } 172 | pCurr = pCurr->pNext; 173 | } 174 | if (bFound) return pCurr->dwType; 175 | return FF_FAIL; 176 | } 177 | 178 | void* CFFGLPluginManager::GetParamDefault(DWORD dwIndex) const 179 | { 180 | ParamInfo* pCurr = m_pFirst; 181 | bool bFound = false; 182 | while (pCurr != NULL) { 183 | if (pCurr->ID == dwIndex) { 184 | bFound = true; 185 | break; 186 | } 187 | pCurr = pCurr->pNext; 188 | } 189 | if (bFound) { 190 | if (GetParamType(dwIndex) == FF_TYPE_TEXT) 191 | return (void*)pCurr->StrDefaultValue; 192 | else 193 | return (void*) &pCurr->DefaultValue; 194 | } 195 | return NULL; 196 | } 197 | 198 | bool CFFGLPluginManager::GetTimeSupported() const 199 | { 200 | return m_timeSupported; 201 | } 202 | -------------------------------------------------------------------------------- /FFGL/FFGLPluginManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 - InfoMus Lab - DIST - University of Genova 3 | // 4 | // InfoMus Lab (Laboratorio di Informatica Musicale) 5 | // DIST - University of Genova 6 | // 7 | // http://www.infomus.dist.unige.it 8 | // news://infomus.dist.unige.it 9 | // mailto:staff@infomus.dist.unige.it 10 | // 11 | // Developer: Gualtiero Volpe 12 | // mailto:volpe@infomus.dist.unige.it 13 | // 14 | // Developer: Trey Harrison 15 | // www.harrisondigitalmedia.com 16 | // 17 | // Last modified: October 26 2006 18 | // 19 | 20 | #ifndef FFGLPLUGINMANAGER_STANDARD 21 | #define FFGLPLUGINMANAGER_STANDARD 22 | 23 | 24 | #include "FFGL.h" 25 | 26 | 27 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 28 | /// \class CFFGLPluginManager 29 | /// \brief CFFGLPluginManager manages information concerning a plugin inputs, parameters, and capabilities. 30 | /// \author Gualtiero Volpe 31 | /// \version 1.0.0.3 32 | /// 33 | /// The CFFGLPluginManager class is the base class for FreeFrameGL plugins developed with the FreeFrameGL SDK since it provides 34 | /// them with methods for automatically manage information concerning plugin inputs, paramaters, and capabilities. 35 | /// Examples of information managed by this class are the number of inputs and parameters of a plugin; the name, type and 36 | /// default value of each parameter; the image formats a plugin supports; the supported optimizations. 37 | /// Plugins developed with the FreeFrameGL SDK (and thus having this class as base class) should call the protected methods 38 | /// of this class in order to specify the information related to their inputs, parameters and capabilities. These calls 39 | /// are usually done while constructing the plugin subclass. Plugins subclasses should also call methods of this class in 40 | /// order to get information about the images they are going to process (i.e., their width, height, depth, orientation). 41 | /// The defualt implementations of the FreeFrame gloabal functions call the public methods of this class in order to 42 | /// return to the host information about a plugin inputs, parameters, and capabilities. 43 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 44 | 45 | class CFFGLPluginManager 46 | { 47 | public: 48 | 49 | /// The standard destructor of CFFGLPluginManager. 50 | virtual ~CFFGLPluginManager(); 51 | 52 | /// This method returns the minimum number of inputs the host must provide. 53 | /// It is usually called by the default implementations of the FreeFrame global functions. 54 | /// 55 | /// \return The minimum number of inputs the host must provide. 56 | int GetMinInputs() const; 57 | 58 | /// This method returns the maximum number of inputs the plugin can receive. 59 | /// It is usually called by the default implementations of the FreeFrame global functions. 60 | /// 61 | /// \return The maximum number of inputs the plugin can receive. 62 | int GetMaxInputs() const; 63 | 64 | /// This method returns how may parameters the plugin has. 65 | /// It is usually called by the default implementations of the FreeFrame global functions. 66 | /// 67 | /// \return The number of parameters of the plugin. 68 | int GetNumParams() const; 69 | 70 | /// This method returns the name of the plugin parameter whose index is passed as parameter 71 | /// to the method. It is usually called by the default implementations of the FreeFrame global functions. 72 | /// 73 | /// \param dwIndex The index of the plugin parameter whose name is queried. 74 | /// It should be in the range [0, Number of plugin parameters). 75 | /// \return The name of the plugin parameter whose index is passed to the method. 76 | /// The return value is a pointer to an array of 16 1-byte ASCII characters, 77 | /// not null terminated (see FreeFrame specification). NULL is returned on error. 78 | char* GetParamName(DWORD dwIndex) const; 79 | 80 | /// This method is called to know the type of the plugin parameter whose index is passed as parameter 81 | /// to the method. It is usually called by the default implementations of the FreeFrame global functions. 82 | /// 83 | /// \param dwIndex The index of the plugin parameter whose name is queried. 84 | /// It should be in the range [0, Number of plugin parameters). 85 | /// \return The type of the plugin parameter whose index is passed as parameter to the method. 86 | /// Codes for allowed parameter types are defined in FreeFrame.h. 87 | /// In case of error, FF_FAIL is returned. 88 | DWORD GetParamType(DWORD dwIndex) const; 89 | 90 | /// This method is called to get the default value of the plugin parameter whose index is passed as parameter 91 | /// to the method. It is usually called by the default implementations of the FreeFrame global functions. 92 | /// 93 | /// \param dwIndex The index of the plugin parameter whose name is queried. 94 | /// It should be in the range [0, Number of plugin parameters). 95 | /// \return The default value of the plugin parameter whose index is passed as parameter to the method. 96 | /// The return value should be cast either to a char* in case of text parameters or to a float* 97 | /// in any other case. In case of error, NULL is returned. 98 | void* GetParamDefault(DWORD dwIndex) const; 99 | 100 | /// This method is called by a the host to determine whether the plugin supports the SetTime function 101 | bool GetTimeSupported() const; 102 | 103 | protected: 104 | 105 | /// The standard constructor of CFFGLPluginManager. 106 | /// \remark Notice that the CFFGLPluginManager constructor is a protected member function, i.e., nor CFFGLPluginManager 107 | /// objects nor CFreeFramePlugin objects should be created directly, but only objects of the subclasses 108 | /// implementing specific plugins should be instantiated. 109 | CFFGLPluginManager(); 110 | 111 | /// This method is called by a plugin subclass, derived from this class, to indicate the minimum number 112 | /// of inputs the host must provide. This method is usually called when a plugin object is instantiated 113 | /// (i.e., in the plugin subclass constructor). 114 | /// 115 | /// \param iMinInputs The plugin subclass should set it to the minimum number of inputs 116 | /// the host must provide. 117 | void SetMinInputs(int iMinInputs); 118 | 119 | /// This method is called by a plugin subclass, derived from this class, to indicate the maximum number 120 | /// of inputs the plugin can receive. This method is usually called when a plugin object is instantiated 121 | /// (i.e., in the plugin subclass constructor). 122 | /// 123 | /// \param iMaxInputs The plugin subclass should set it to the maximum number of inputs the plugin 124 | /// can receive. 125 | void SetMaxInputs(int iMaxInputs); 126 | 127 | /// This method is called by a plugin subclass, derived from this class, to specify name, type, and default 128 | /// value of the plugin parameter whose index is passed as parameter to the method. This method is usually 129 | /// called when a plugin object is instantiated (i.e., in the plugin subclass contructor). This version of 130 | /// the SetParamInfo function (DefaultValue of type float) should be called for all types of plugin parameters 131 | /// except for text, boolean, and event parameters. 132 | /// 133 | /// \param dwIndex Index of the plugin parameter whose data are specified. 134 | /// It should be in the range [0, Number of plugin parameters). 135 | /// \param pchName A string containing the name of the plugin parameter. 136 | /// According to the FreeFrame specification it should be at most 16 1-byte ASCII 137 | /// characters long. Longer strings will be truncated at the 16th character. 138 | /// \param dwType The type of the plugin parameter. Codes for allowed types are defined in FreeFrame.h. 139 | /// \param fDefaultValue The default value of the plugin parameter. According to the FreeFrame 140 | /// specification it must be a float in the range [0, 1]. 141 | void SetParamInfo(DWORD dwIndex, const char* pchName, DWORD dwType, float fDefaultValue); 142 | 143 | /// This method is called by a plugin subclass, derived from this class, to specify name, type, and default 144 | /// value of the plugin parameter whose index is passed as parameter to the method. This method is usually 145 | /// called when a plugin object is instantiated (i.e., in the plugin subclass contructor). This version of 146 | /// the SetParamInfo function (DefaultValue of type bool) should be called for plugin parameters of type 147 | /// boolean or event. 148 | /// 149 | /// \param dwIndex Index of the plugin parameter whose data are specified. 150 | /// It should be in the range [0, Number of plugin parameters). 151 | /// \param pchName A string containing the name of the plugin parameter. 152 | /// According to the FreeFrame specification it should be at most 16 1-byte ASCII 153 | /// characters long. Longer strings will be truncated at the 16th character. 154 | /// \param dwType The type of the plugin parameter. Codes for allowed types are defined in FreeFrame.h. 155 | /// \param bDefaultValue The boolean default value of the plugin parameter. 156 | void SetParamInfo(DWORD dwIndex, const char* pchName, DWORD dwType, bool bDefaultValue); 157 | 158 | /// This method is called by a plugin subclass, derived from this class, to specify name, type, and default 159 | /// value of the plugin parameter whose index is passed as parameter to the method. This method is usually 160 | /// called when a plugin object is instantiated (i.e., in the plugin subclass contructor). This version of 161 | /// the SetParamInfo function (DefaultValue of type char*) should be called for plugin parameters of type text. 162 | /// 163 | /// \param dwIndex Index of the plugin parameter whose data are specified. 164 | /// It should be in the range [0, Number of plugin parameters). 165 | /// \param pchName A string containing the name of the plugin parameter. 166 | /// According to the FreeFrame specification it should be at most 16 1-byte ASCII 167 | /// characters long. Longer strings will be truncated at the 16th character. 168 | /// \param dwType The type of the plugin parameter. Codes for allowed types are defined in FreeFrame.h. 169 | /// \param pchDefaultValue A string to be used as the default value of the plugin parameter. 170 | void SetParamInfo(DWORD dwIndex, const char* pchName, DWORD dwType, const char* pchDefaultValue); 171 | 172 | /// This method is called by a plugin subclass, derived from this class, to indicate whether the 173 | /// SetTime function is supported 174 | /// 175 | /// \param supported The plugin indicates whether it supports the SetTime function by passing true or false (1 or 0) 176 | void SetTimeSupported(bool supported); 177 | 178 | private: 179 | 180 | // Structure for keeping information about each plugin parameter 181 | typedef struct ParamInfoStruct { 182 | DWORD ID; 183 | char Name[16]; 184 | DWORD dwType; 185 | float DefaultValue; 186 | char* StrDefaultValue; 187 | ParamInfoStruct* pNext; 188 | } ParamInfo; 189 | 190 | // Information on paramters and pointers to ParamInfo list 191 | int m_NParams; 192 | ParamInfo* m_pFirst; 193 | ParamInfo* m_pLast; 194 | 195 | // Inputs 196 | int m_iMinInputs; 197 | int m_iMaxInputs; 198 | 199 | // Time capability 200 | bool m_timeSupported; 201 | }; 202 | 203 | 204 | #include "FFGLPluginManager_inl.h" 205 | 206 | #endif 207 | 208 | -------------------------------------------------------------------------------- /FFGL/FFGLPluginManager_inl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 - InfoMus Lab - DIST - University of Genova 3 | // 4 | // InfoMus Lab (Laboratorio di Informatica Musicale) 5 | // DIST - University of Genova 6 | // 7 | // http://www.infomus.dist.unige.it 8 | // news://infomus.dist.unige.it 9 | // mailto:staff@infomus.dist.unige.it 10 | // 11 | // Developer: Gualtiero Volpe 12 | // mailto:volpe@infomus.dist.unige.it 13 | // 14 | // Developer: Trey Harrison 15 | // www.harrisondigitalmedia.com 16 | // 17 | // Last modified: Oct. 26 2006 18 | // 19 | 20 | 21 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 22 | // CFFGLPluginManager inline methods 23 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 24 | 25 | inline int CFFGLPluginManager::GetMinInputs() const 26 | { 27 | return m_iMinInputs; 28 | } 29 | 30 | inline int CFFGLPluginManager::GetMaxInputs() const 31 | { 32 | return m_iMaxInputs; 33 | } 34 | 35 | inline int CFFGLPluginManager::GetNumParams() const 36 | { 37 | return m_NParams; 38 | } -------------------------------------------------------------------------------- /FFGL/FFGLPluginSDK.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 - InfoMus Lab - DIST - University of Genova 3 | // 4 | // InfoMus Lab (Laboratorio di Informatica Musicale) 5 | // DIST - University of Genova 6 | // 7 | // http://www.infomus.dist.unige.it 8 | // news://infomus.dist.unige.it 9 | // mailto:staff@infomus.dist.unige.it 10 | // 11 | // Developer: Gualtiero Volpe 12 | // mailto:volpe@infomus.dist.unige.it 13 | // 14 | // Developer: Trey Harrison 15 | // mailto:trey@treyharrison.com 16 | // 17 | // Last modified: Oct. 26 2006 18 | // 19 | 20 | #include "FFGLPluginSDK.h" 21 | #include 22 | #include 23 | 24 | // Buffer used by the default implementation of getParameterDisplay 25 | 26 | 27 | 28 | //////////////////////////////////////////////////////// 29 | // CFreeFrameGLPlugin constructor and destructor 30 | //////////////////////////////////////////////////////// 31 | 32 | CFreeFrameGLPlugin::CFreeFrameGLPlugin() 33 | : CFFGLPluginManager() 34 | { 35 | } 36 | 37 | CFreeFrameGLPlugin::~CFreeFrameGLPlugin() 38 | { 39 | } 40 | 41 | 42 | //////////////////////////////////////////////////////// 43 | // Default implementation of CFreeFrameGLPlugin methods 44 | //////////////////////////////////////////////////////// 45 | 46 | char* CFreeFrameGLPlugin::GetParameterDisplay(DWORD dwIndex) 47 | { 48 | DWORD dwType = m_pPlugin->GetParamType(dwIndex); 49 | DWORD dwValue = m_pPlugin->GetParameter(dwIndex); 50 | 51 | if ((dwValue != FF_FAIL) && (dwType != FF_FAIL)) 52 | { 53 | if (dwType == FF_TYPE_TEXT) 54 | { 55 | return (char *)dwValue; 56 | } 57 | else 58 | { 59 | char s_DisplayValue[15]; 60 | float fValue; 61 | memcpy(&fValue, &dwValue, 4); 62 | memset(s_DisplayValue, 0, 15); 63 | sprintf(s_DisplayValue, "%1.2f", fValue); 64 | return s_DisplayValue; 65 | } 66 | } 67 | return NULL; 68 | } 69 | 70 | DWORD CFreeFrameGLPlugin::SetParameter(const SetParameterStruct* pParam) 71 | { 72 | return FF_FAIL; 73 | } 74 | 75 | DWORD CFreeFrameGLPlugin::GetParameter(DWORD dwIndex) 76 | { 77 | return FF_FAIL; 78 | } 79 | 80 | DWORD CFreeFrameGLPlugin::GetInputStatus(DWORD dwIndex) 81 | { 82 | if (dwIndex >= (DWORD)GetMaxInputs()) return FF_FAIL; 83 | return FF_INPUT_INUSE; 84 | } 85 | -------------------------------------------------------------------------------- /FFGL/FFGLPluginSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2004 - InfoMus Lab - DIST - University of Genova 3 | // 4 | // InfoMus Lab (Laboratorio di Informatica Musicale) 5 | // DIST - University of Genova 6 | // 7 | // http://www.infomus.dist.unige.it 8 | // news://infomus.dist.unige.it 9 | // mailto:staff@infomus.dist.unige.it 10 | // 11 | // Developer: Gualtiero Volpe 12 | // mailto:volpe@infomus.dist.unige.it 13 | // 14 | // Developer: Trey Harrison 15 | // www.harrisondigitalmedia.com 16 | // 17 | // Last modified: October 26 2006 18 | // 19 | 20 | #ifndef FFGLPLUGINSDK_STANDARD 21 | #define FFGLPLUGINSDK_STANDARD 22 | 23 | #include "FFGLPluginManager.h" 24 | #include "FFGLPluginInfo.h" 25 | 26 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 27 | /// \class CFreeFrameGLPlugin 28 | /// \brief CFreeFrameGLPlugin is the base class for all FreeFrameGL plugins developed with the FreeFrameGL SDK. 29 | /// \author Gualtiero Volpe 30 | /// \version 1.0.0.2 31 | /// 32 | /// The CFreeFrameGLPlugin class is the base class for every FreeFrameGL plugins developed with the FreeFrameGL SDK. 33 | /// It is derived from CFFGLPluginManager, so that most of the plugin management and communication with the host 34 | /// can be transparently handled through the default implementations of the methods of CFFGLPluginManager. 35 | /// While CFFGLPluginManager is used by the global FreeFrame methods, CFreeFrameGLPlugin provides a default implementation 36 | /// of the instance specific FreeFrame functions. Note that CFreeFrameGLPlugin methods are virtual methods: any given 37 | /// FreeFrameGL plugin developed with the FreeFrameGL SDK will be a derived class of CFreeFrameGLPlugin and will have to 38 | /// provide a custom implementation of most of such methods. Except for CFreeFrameGLPlugin::GetParameterDisplay and 39 | /// CFreeFrameGLPlugin::GetInputStatus, all the default methods of CFreeFrameGLPlugin just return FF_FAIL: every derived 40 | /// plugin is responsible of providing its specific implementation of such default methods. 41 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 42 | 43 | class CFreeFrameGLPlugin : 44 | public CFFGLPluginManager 45 | { 46 | public: 47 | 48 | /// The standard destructor of CFreeFrameGLPlugin. 49 | virtual ~CFreeFrameGLPlugin(); 50 | 51 | /// Default implementation of the FFGL InitGL instance specific function. This function allocates 52 | /// the OpenGL resources the plugin needs during its lifetime 53 | /// 54 | /// \param vp Pointer to a FFGLViewportStruct structure (see the definition in FFGL.h and 55 | /// the description in the FFGL specification). 56 | /// \return The default implementation always returns FF_SUCCESS. 57 | /// A custom implementation must be provided by every specific plugin that allocates 58 | /// any OpenGL resources 59 | virtual DWORD InitGL(const FFGLViewportStruct *vp) { return FF_SUCCESS; } 60 | 61 | /// Default implementation of the FFGL DeInitGL instance specific function. This function frees 62 | /// any OpenGL resources the plugin has allocated 63 | /// 64 | /// \return The default implementation always returns FF_SUCCESS. 65 | /// A custom implementation must be provided by every specific plugin that allocates 66 | /// any OpenGL resources 67 | virtual DWORD DeInitGL() { return FF_SUCCESS; } 68 | 69 | /// Default implementation of the FreeFrame getParameterDisplay instance specific function. It provides a string 70 | /// to display as the value of the plugin parameter whose index is passed as parameter to the method. This default 71 | /// implementation just returns the string representation of the float value of the plugin parameter. A custom 72 | /// implementation may be provided by every specific plugin. 73 | /// 74 | /// \param dwIndex The index of the parameter whose display value is queried. 75 | /// It should be in the range [0, Number of plugin parameters). 76 | /// \return The display value of the plugin parameter or NULL in case of error 77 | virtual char* GetParameterDisplay(DWORD dwIndex); 78 | 79 | /// Default implementation of the FreeFrame setParameter instance specific function. It allows setting the current 80 | /// value of the plugin parameter whose index is passed as parameter to the method. This default implementation 81 | /// always returns FF_FAIL. A custom implementation must be provided by every specific plugin. 82 | /// 83 | /// \param pParam A pointer to a SetParameterStruct (see FreeFrame.h and FreeFrame specification for 84 | /// further information) containing the index and the new value of the plugin parameter 85 | /// whose value is going to be set. The parameter index should be in the range 86 | /// [0, Number of plugin parameters). 87 | /// \return The default implementation always returns FF_FAIL. 88 | /// A custom implementation must be provided. 89 | virtual DWORD SetParameter(const SetParameterStruct* pParam); 90 | 91 | /// Default implementation of the FreeFrame getParameter instance specific function. It allows getting the current 92 | /// value of the plugin parameter whose index is passed as parameter to the method. This default implementation 93 | /// always returns FF_FAIL. A custom implementation must be provided by every specific plugin. 94 | /// 95 | /// \param dwIndex The index of the parameter whose current value is queried. 96 | /// It should be in the range [0, Number of plugin parameters). 97 | /// \return The default implementation always returns FF_FAIL. 98 | /// A custom implementation must be provided by every specific plugin 99 | virtual DWORD GetParameter(DWORD dwIndex); 100 | 101 | /// Default implementation of the FFGL ProcessOpenGL instance specific function. This function processes 102 | /// the input texture(s) by 103 | /// 104 | /// \param pOpenGLData to a ProcessOpenGLStruct structure (see the definition in FFGL.h and 105 | /// the description in the FFGL specification). 106 | /// \return The default implementation always returns FF_FAIL. 107 | /// A custom implementation must be provided by every specific plugin. 108 | virtual DWORD ProcessOpenGL(ProcessOpenGLStruct* pOpenGLData) { return FF_FAIL; } 109 | 110 | /// Default implementation of the FFGL SetTime instance specific function 111 | /// 112 | /// \param pOpenGLData to a ProcessOpenGLStruct structure (see the definition in FFGL.h and 113 | /// the description in the FFGL specification). 114 | /// \return The default implementation always returns FF_FAIL. 115 | /// A custom implementation must be provided by every specific plugin. 116 | virtual DWORD SetTime(double time) { return FF_FAIL; } 117 | 118 | /// Default implementation of the FreeFrame getInputStatus instance specific function. This function is called 119 | /// to know whether a given input is currently in use. For the default implementation every input is always in use. 120 | /// A custom implementation may be provided by every specific plugin. 121 | /// 122 | /// \param dwIndex The index of the input whose status is queried. 123 | /// It should be in the range [Minimum number of inputs, Maximum number of inputs). 124 | /// \return The default implementation always returns FF_FF_INPUT_INUSE or FF_FAIL if the index 125 | /// is out of range. A custom implementation may be provided by every specific plugin. 126 | virtual DWORD GetInputStatus(DWORD dwIndex); 127 | 128 | /// The only public data field CFreeFrameGLPlugin contains is m_pPlugin, a pointer to the plugin instance. 129 | /// Subclasses may use this pointer for self-referencing (e.g., a plugin may pass this pointer to external modules, 130 | /// so that they can use it for calling the plugin methods). 131 | CFreeFrameGLPlugin *m_pPlugin; 132 | 133 | protected: 134 | 135 | /// The only protected function of CFreeFrameGLPlugin is its constructor. In fact, nor CFFGLPluginManager objects nor 136 | /// CFreeFrameGLPlugin objects should be created directly, but only objects of the subclasses implementing specific 137 | /// plugins should be instantiated. Moreover, subclasses should define and provide a factory method to be used by 138 | /// the FreeFrame SDK for instantiating plugin objects. 139 | CFreeFrameGLPlugin(); 140 | }; 141 | 142 | 143 | #endif 144 | -------------------------------------------------------------------------------- /FFGL/FFGLShader.h: -------------------------------------------------------------------------------- 1 | #ifndef FFGLShader_H 2 | #define FFGLShader_H 3 | 4 | #include 5 | #include 6 | 7 | class FFGLShader 8 | { 9 | public: 10 | FFGLShader(); 11 | virtual ~FFGLShader(); 12 | 13 | void SetExtensions(FFGLExtensions *e); 14 | 15 | int IsReady() { return (m_glProgram!=0 && m_glVertexShader!=0 && m_glFragmentShader!=0 && m_linkStatus==1); } 16 | 17 | int Compile(const char *vtxProgram, const char *fragProgram); 18 | 19 | GLuint FindUniform(const char *name); 20 | 21 | int BindShader(); 22 | int UnbindShader(); 23 | 24 | void FreeGLResources(); 25 | 26 | private: 27 | FFGLExtensions *m_extensions; 28 | GLenum m_glProgram; 29 | GLenum m_glVertexShader; 30 | GLenum m_glFragmentShader; 31 | GLuint m_linkStatus; 32 | 33 | void CreateGLResources(); 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /FFGL/FreeFrame.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // FreeFrame.h 3 | // 4 | // FreeFrame is an open-source cross-platform real-time video effects plugin system. 5 | // It provides a framework for developing video effects plugins and hosts on Windows, 6 | // Linux and Mac OSX. 7 | // 8 | // Copyright (c) 2002, 2003, 2004, 2005, 2006 www.freeframe.org 9 | // All rights reserved. 10 | // 11 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 12 | 13 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 14 | // 15 | // Redistribution and use in source and binary forms, with or without modification, 16 | // are permitted provided that the following conditions are met: 17 | // 18 | // * Redistributions of source code must retain the above copyright 19 | // notice, this list of conditions and the following disclaimer. 20 | // * Redistributions in binary form must reproduce the above copyright 21 | // notice, this list of conditions and the following disclaimer in 22 | // the documentation and/or other materials provided with the 23 | // distribution. 24 | // * Neither the name of FreeFrame nor the names of its 25 | // contributors may be used to endorse or promote products derived 26 | // from this software without specific prior written permission. 27 | // 28 | // 29 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 30 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 31 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 32 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 33 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 34 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 36 | // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 37 | // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 38 | // OF THE POSSIBILITY OF SUCH DAMAGE. 39 | // 40 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 41 | 42 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 43 | // 44 | // First version, Marcus Clements (marcus@freeframe.org) 45 | // www.freeframe.org 46 | // 47 | // FreeFrame 1.0 upgrade by Pete Warden 48 | // www.petewarden.com 49 | // 50 | // FreeFrame 1.0 - 03 upgrade by Gualtiero Volpe 51 | // Gualtiero.Volpe@poste.it 52 | // 53 | // #ifdef tweaks for FreeFrameGL upgrade by Trey Harrison 54 | // www.harrisondigitalmedia.com 55 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 56 | 57 | 58 | #ifndef __FREEFRAME_H__ 59 | #define __FREEFRAME_H__ 60 | 61 | #if _MSC_VER > 1000 62 | #pragma once 63 | #endif 64 | 65 | 66 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 67 | // Includes 68 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 69 | 70 | #ifdef _WIN32 71 | 72 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 73 | #include 74 | 75 | #else 76 | 77 | extern "C" { 78 | 79 | #include 80 | #include 81 | 82 | #endif 83 | 84 | 85 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 86 | // FreeFrame defines 87 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 88 | 89 | // Function codes 90 | #define FF_GETINFO 0 91 | #define FF_INITIALISE 1 92 | #define FF_DEINITIALISE 2 93 | #define FF_PROCESSFRAME 3 94 | #define FF_GETNUMPARAMETERS 4 95 | #define FF_GETPARAMETERNAME 5 96 | #define FF_GETPARAMETERDEFAULT 6 97 | #define FF_GETPARAMETERDISPLAY 7 98 | #define FF_SETPARAMETER 8 99 | #define FF_GETPARAMETER 9 100 | #define FF_GETPLUGINCAPS 10 101 | #define FF_INSTANTIATE 11 102 | #define FF_DEINSTANTIATE 12 103 | #define FF_GETEXTENDEDINFO 13 104 | #define FF_PROCESSFRAMECOPY 14 105 | #define FF_GETPARAMETERTYPE 15 106 | #define FF_GETIPUTSTATUS 16 107 | 108 | // Return values 109 | #define FF_SUCCESS 0 110 | #define FF_FAIL 0xFFFFFFFF 111 | #define FF_TRUE 1 112 | #define FF_FALSE 0 113 | #define FF_SUPPORTED 1 114 | #define FF_UNSUPPORTED 0 115 | 116 | // Plugin types 117 | #define FF_EFFECT 0 118 | #define FF_SOURCE 1 119 | 120 | // Plugin capabilities 121 | #define FF_CAP_16BITVIDEO 0 122 | #define FF_CAP_24BITVIDEO 1 123 | #define FF_CAP_32BITVIDEO 2 124 | #define FF_CAP_PROCESSFRAMECOPY 3 125 | #define FF_CAP_MINIMUMINPUTFRAMES 10 126 | #define FF_CAP_MAXIMUMINPUTFRAMES 11 127 | #define FF_CAP_COPYORINPLACE 15 128 | 129 | // Plugin optimization 130 | #define FF_CAP_PREFER_NONE 0 131 | #define FF_CAP_PREFER_INPLACE 1 132 | #define FF_CAP_PREFER_COPY 2 133 | #define FF_CAP_PREFER_BOTH 3 134 | 135 | // Parameter types 136 | #define FF_TYPE_BOOLEAN 0 137 | #define FF_TYPE_EVENT 1 138 | #define FF_TYPE_RED 2 139 | #define FF_TYPE_GREEN 3 140 | #define FF_TYPE_BLUE 4 141 | #define FF_TYPE_XPOS 5 142 | #define FF_TYPE_YPOS 6 143 | #define FF_TYPE_STANDARD 10 144 | #define FF_TYPE_TEXT 100 145 | 146 | // Input status 147 | #define FF_INPUT_NOTINUSE 0 148 | #define FF_INPUT_INUSE 1 149 | 150 | // Image depth 151 | #define FF_DEPTH_16 0 152 | #define FF_DEPTH_24 1 153 | #define FF_DEPTH_32 2 154 | 155 | // Image orientation 156 | #define FF_ORIENTATION_TL 1 157 | #define FF_ORIENTATION_BL 2 158 | 159 | 160 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 161 | // FreeFrame Types 162 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 163 | 164 | // Typedefs for Linux and MacOS - in Windows these are defined in files included by windows.h 165 | #ifndef _WIN32 166 | typedef unsigned int DWORD; 167 | typedef unsigned char BYTE; 168 | typedef void *LPVOID; 169 | #endif 170 | 171 | // PluginInfoStruct 172 | typedef struct PluginInfoStructTag { 173 | DWORD APIMajorVersion; 174 | DWORD APIMinorVersion; 175 | BYTE PluginUniqueID[4]; // 4 chars uniqueID - not null terminated 176 | BYTE PluginName[16]; // 16 chars plugin friendly name - not null terminated 177 | DWORD PluginType; // Effect or source 178 | } PluginInfoStruct; 179 | 180 | // PluginExtendedInfoStruct 181 | typedef struct PluginExtendedInfoStructTag { 182 | DWORD PluginMajorVersion; 183 | DWORD PluginMinorVersion; 184 | char* Description; 185 | char* About; 186 | DWORD FreeFrameExtendedDataSize; 187 | void* FreeFrameExtendedDataBlock; 188 | } PluginExtendedInfoStruct; 189 | 190 | // VideoInfoStruct 191 | typedef struct VideoInfoStructTag { 192 | DWORD FrameWidth; // width of frame in pixels 193 | DWORD FrameHeight; // height of frame in pixels 194 | DWORD BitDepth; // enumerated indicator of bit depth of video: 0 = 16 bit 5-6-5 1 = 24bit packed 2 = 32bit 195 | DWORD Orientation; 196 | } VideoInfoStruct; 197 | 198 | // ProcessFrameCopyStruct 199 | typedef struct ProcessFrameCopyStructTag { 200 | DWORD numInputFrames; 201 | void** ppInputFrames; 202 | void* pOutputFrame; 203 | } ProcessFrameCopyStruct; 204 | 205 | // SetParameterStruct 206 | typedef struct SetParameterStructTag { 207 | DWORD ParameterNumber; 208 | DWORD NewParameterValue; 209 | } SetParameterStruct; 210 | 211 | // plugMain function return values 212 | typedef union plugMainUnionTag { 213 | DWORD ivalue; 214 | float fvalue; 215 | VideoInfoStruct* VISvalue; 216 | PluginInfoStruct* PISvalue; 217 | char* svalue; 218 | } plugMainUnion; 219 | 220 | 221 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 222 | // Function prototypes 223 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 224 | 225 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 226 | // plugMain - The one and only exposed function 227 | // parameters: 228 | // functionCode - tells the plugin which function is being called 229 | // pParam - 32-bit parameter or 32-bit pointer to parameter structure 230 | // 231 | // PLUGIN DEVELOPERS: you shouldn't need to change this function 232 | // 233 | // All parameters are cast as 32-bit untyped pointers and cast to appropriate 234 | // types here 235 | // 236 | // All return values are cast to 32-bit untyped pointers here before return to 237 | // the host 238 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 239 | 240 | #ifdef _WIN32 241 | 242 | BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved); 243 | 244 | __declspec(dllexport) plugMainUnion __stdcall plugMain(DWORD functionCode, DWORD inputValue, DWORD instanceID); 245 | typedef __declspec(dllimport) plugMainUnion (__stdcall *FF_Main_FuncPtr)(DWORD, DWORD, DWORD); 246 | 247 | #else 248 | 249 | //linux and Mac OSX share these 250 | plugMainUnion plugMain(DWORD functionCode, DWORD inputValue, DWORD instanceID); 251 | typedef plugMainUnion (*FF_Main_FuncPtr)(DWORD funcCode, DWORD inputVal, DWORD instanceID); 252 | 253 | #endif 254 | 255 | #ifndef _WIN32 256 | } 257 | #endif 258 | 259 | #endif 260 | -------------------------------------------------------------------------------- /FFGLGeometryMixer.cpp: -------------------------------------------------------------------------------- 1 | #include "FFGLGeometryMixer.h" 2 | 3 | #define FFPARAM_Blend (0) 4 | 5 | 6 | static CFFGLPluginInfo PluginInfo ( 7 | FFGLGeometryMixer::CreateInstance, // Create method 8 | "TriX", // Plugin unique ID 9 | "Triangle MX", // Plugin name 10 | 1, // API major version number 11 | 000, // API minor version number 12 | 1, // Plugin major version number 13 | 000, // Plugin minor version number 14 | FF_EFFECT, // Plugin type 15 | "FFGL Triangle MX", // Plugin description 16 | "by Oleg Potiy" // About 17 | ); 18 | 19 | FFGLGeometryMixer::FFGLGeometryMixer(void):CFreeFrameGLPlugin() 20 | { 21 | // Input properties 22 | SetMinInputs(2); 23 | SetMaxInputs(2); 24 | 25 | // parameters: 26 | SetParamInfo(FFPARAM_Blend, "Blend", FF_TYPE_STANDARD, 0.5f); 27 | m_blend = 0.5f; 28 | } 29 | 30 | 31 | FFGLGeometryMixer::~FFGLGeometryMixer(void) 32 | { 33 | } 34 | 35 | 36 | DWORD FFGLGeometryMixer::SetParameter(const SetParameterStruct* pParam) 37 | { 38 | float fNewValue = 0; 39 | 40 | if (pParam != NULL) 41 | { 42 | fNewValue = *((float *)(unsigned)&(pParam->NewParameterValue)); 43 | 44 | switch(pParam->ParameterNumber) 45 | { 46 | case 0: 47 | 48 | this->m_blend = fNewValue; 49 | 50 | this->pattern = (TexPattern)(unsigned char)(this->m_blend * (TexPattern::All + 0.9)); 51 | 52 | break; 53 | 54 | default: 55 | return FF_FAIL; 56 | } 57 | }; 58 | return FF_SUCCESS; 59 | } 60 | 61 | DWORD FFGLGeometryMixer::GetParameter(DWORD dwIndex) 62 | { 63 | DWORD dwReturnValue; 64 | 65 | switch (dwIndex) 66 | { 67 | case FFPARAM_Blend: 68 | *((float*)(unsigned)(&dwReturnValue)) = this->m_blend; 69 | return dwReturnValue; 70 | 71 | default: 72 | return FF_FAIL; 73 | } 74 | 75 | return FF_FAIL; 76 | } 77 | 78 | DWORD FFGLGeometryMixer::ProcessOpenGL(ProcessOpenGLStruct* pGL) 79 | { 80 | if (pGL->numInputTextures < 2) 81 | return FF_FAIL; 82 | 83 | if (pGL->inputTextures[0]==NULL || pGL->inputTextures[1]==NULL ) 84 | return FF_FAIL; 85 | 86 | return this->ScalableTriangleMeshMix(pGL); 87 | } 88 | 89 | 90 | 91 | const static double divisor = 1.7320508075688772935274463415059L; 92 | 93 | DWORD FFGLGeometryMixer::ScalableTriangleMeshMix(ProcessOpenGLStruct* pGL) 94 | { 95 | 96 | FFGLTextureStruct &TextureObject1 = *(pGL->inputTextures[0]); 97 | FFGLTextureStruct &TextureObject2 = *(pGL->inputTextures[1]); 98 | 99 | DWORD frameHeight = pGL->inputTextures[0]->HardwareHeight; 100 | DWORD frameWidth = pGL->inputTextures[0]->HardwareWidth; 101 | 102 | double triangleSide = frameHeight / divisor; 103 | double halfTriangleSide = frameHeight / (2. * divisor); 104 | 105 | int triNum = (int)((frameWidth / 2. - halfTriangleSide) / triangleSide) + 1; 106 | double nrmTriangleSide = triangleSide / frameWidth; 107 | double nrmHalfTriangleSide = halfTriangleSide / frameWidth; 108 | 109 | 110 | glEnable(GL_TEXTURE_2D); 111 | 112 | double leftTexBorder = 0.5 - frameHeight/(frameWidth*divisor); 113 | double rightTexBorder = 0.5 + frameHeight/(frameWidth*divisor); 114 | 115 | 116 | if (this->pattern == TexPattern::SplitAsGeometry ) 117 | { 118 | // Top central triangle 119 | glBindTexture(GL_TEXTURE_2D, TextureObject1.Handle); 120 | glBegin(GL_TRIANGLES); 121 | 122 | glTexCoord2f(0.5 - nrmHalfTriangleSide, 0.5); 123 | glVertex3f(-nrmTriangleSide, 0.0, 0.0); 124 | 125 | glTexCoord2f(0.5, 1); 126 | glVertex3f(0.0, 1.0, 0.0); 127 | 128 | glTexCoord2f(0.5 + nrmHalfTriangleSide, 0.5); 129 | glVertex3f(nrmTriangleSide, 0.0, 0.0); 130 | glEnd(); 131 | 132 | // Bottom central triangle 133 | glBindTexture(GL_TEXTURE_2D, TextureObject2.Handle); 134 | glBegin(GL_TRIANGLES); 135 | 136 | glTexCoord2f(0.5 - (halfTriangleSide / (double)frameWidth), 0.5); 137 | glVertex3f(-nrmTriangleSide, 0.0, 0.0); 138 | 139 | glTexCoord2f(0.5 + (halfTriangleSide / (double)frameWidth), 0.5); 140 | glVertex3f(nrmTriangleSide, 0.0, 0.0); 141 | 142 | glTexCoord2f(0.5, 0); 143 | glVertex3f(0.0, -1.0, 0.0); 144 | glEnd(); 145 | } 146 | else 147 | { 148 | // Top central triangle 149 | glBindTexture(GL_TEXTURE_2D, TextureObject1.Handle); 150 | glBegin(GL_TRIANGLES); 151 | 152 | glTexCoord2f(leftTexBorder, 0.0); 153 | glVertex3f(-nrmTriangleSide, 0.0, 0.0); 154 | 155 | glTexCoord2f(0.5, 1.0); 156 | glVertex3f(0.0, 1.0, 0.0); 157 | 158 | glTexCoord2f(rightTexBorder, 0.0); 159 | glVertex3f(nrmTriangleSide, 0.0, 0.0); 160 | 161 | glEnd(); 162 | 163 | // Bottom central triangle 164 | glBindTexture(GL_TEXTURE_2D, TextureObject2.Handle); 165 | glBegin(GL_TRIANGLES); 166 | 167 | glTexCoord2f(leftTexBorder, 1.0); 168 | glVertex3f(-nrmTriangleSide, 0.0, 0.0); 169 | 170 | glTexCoord2f(rightTexBorder, 1.0); 171 | glVertex3f(nrmTriangleSide, 0.0, 0.0); 172 | 173 | glTexCoord2f( 0.5, 0.0); 174 | glVertex3f(0.0, -1.0, 0.0); 175 | 176 | glEnd(); 177 | } 178 | 179 | 180 | 181 | 182 | glBindTexture(GL_TEXTURE_2D, TextureObject1.Handle); 183 | glBegin(GL_TRIANGLES); 184 | 185 | double localShift = 0; 186 | 187 | for (int i=0 ; i < triNum ; i ++) 188 | { 189 | if (this->pattern == TexPattern::All ) 190 | { 191 | // upper right triangles ->/ 192 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 193 | glTexCoord2f(leftTexBorder, 0.0); 194 | glVertex3f( 2.*localShift , 0.0, 0.0); 195 | 196 | localShift = (i+1)*nrmTriangleSide; 197 | glTexCoord2f(0.5, 1.0); 198 | glVertex3f(2.*localShift, 1.0, 0.0); 199 | 200 | localShift = nrmHalfTriangleSide + (i+1)*nrmTriangleSide; 201 | glTexCoord2f(rightTexBorder, 0.0); 202 | glVertex3f(2.*localShift, 0.0, 0.0); 203 | 204 | 205 | // upper left triangles <-/ 206 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 207 | glTexCoord2f(rightTexBorder, 0.0); 208 | glVertex3f( -2.*localShift, 0.0, 0.0); 209 | 210 | localShift = (i+1)*nrmTriangleSide; 211 | glTexCoord2f(0.5, 1.0); 212 | glVertex3f(-2.*localShift, 1.0, 0.0); 213 | 214 | localShift = nrmHalfTriangleSide + (i+1)*nrmTriangleSide; 215 | glTexCoord2f(leftTexBorder, 0.0); 216 | glVertex3f(-2.*localShift, 0.0, 0.0); 217 | } 218 | else 219 | { 220 | // upper right triangles ->/ 221 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 222 | glTexCoord2f(0.5 + localShift, 0.5); 223 | glVertex3f( 2.*localShift , 0.0, 0.0); 224 | 225 | localShift = (i+1)*nrmTriangleSide; 226 | glTexCoord2f(0.5 + localShift, 1.0); 227 | glVertex3f(2.*localShift, 1.0, 0.0); 228 | 229 | localShift = nrmHalfTriangleSide + (i+1)*nrmTriangleSide; 230 | glTexCoord2f(0.5 + localShift, 0.5); 231 | glVertex3f(2.*localShift, 0.0, 0.0); 232 | 233 | 234 | // upper left triangles <-/ 235 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 236 | glTexCoord2f(0.5 - localShift, 0.5); 237 | glVertex3f( -2.*localShift, 0.0, 0.0); 238 | 239 | localShift = (i+1)*nrmTriangleSide; 240 | glTexCoord2f(0.5 - localShift, 1.0); 241 | glVertex3f(-2.*localShift, 1.0, 0.0); 242 | 243 | localShift = nrmHalfTriangleSide + (i+1)*nrmTriangleSide; 244 | glTexCoord2f(0.5 - localShift, 0.5); 245 | glVertex3f(-2.*localShift, 0.0, 0.0); 246 | } 247 | 248 | } 249 | 250 | triNum = (double)frameWidth / 2. / triangleSide; 251 | triNum += 1; 252 | for (int i=0 ; i < triNum ; i ++) 253 | { 254 | if ((i == 0 && this->pattern == TexPattern::WithAdjacents) || this->pattern == TexPattern::All) 255 | { 256 | // lower right triangles /-> 257 | localShift = i * nrmTriangleSide; 258 | glTexCoord2f(leftTexBorder, 0.0); 259 | glVertex3f( 2.*localShift, -1., 0.0); 260 | 261 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 262 | glTexCoord2f(0.5, 1.); 263 | glVertex3f(2.*localShift, 0.0, 0.0); 264 | 265 | localShift = (i+1)*nrmTriangleSide; 266 | glTexCoord2f(rightTexBorder, 0.0); 267 | glVertex3f(2.*localShift, -1., 0.0); 268 | 269 | 270 | // lower left triangles /<- 271 | localShift = (i+1)*nrmTriangleSide; 272 | glTexCoord2f(leftTexBorder, 0.0); 273 | glVertex3f(-2.*localShift, -1.0, 0.0); 274 | 275 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 276 | glTexCoord2f(0.5, 1.); 277 | glVertex3f(-2.*localShift, 0.0, 0.0); 278 | 279 | localShift = i*nrmTriangleSide; 280 | glTexCoord2f(rightTexBorder, 0.0); 281 | glVertex3f(-2.*localShift, -1.0, 0.0); 282 | } 283 | else 284 | { 285 | // lower right triangles /-> 286 | localShift = i * nrmTriangleSide; 287 | glTexCoord2f(0.5 + localShift, 0.0); 288 | glVertex3f( 2.*localShift, -1., 0.0); 289 | 290 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 291 | glTexCoord2f(0.5 + localShift, 0.5); 292 | glVertex3f(2.*localShift, 0.0, 0.0); 293 | 294 | localShift = (i+1)*nrmTriangleSide; 295 | glTexCoord2f(0.5 + localShift, 0.0); 296 | glVertex3f(2.*localShift, -1., 0.0); 297 | 298 | 299 | // lower left triangles /<- 300 | localShift = (i+1)*nrmTriangleSide; 301 | glTexCoord2f(0.5 - localShift, 0.0); 302 | glVertex3f(-2.*localShift, -1.0, 0.0); 303 | 304 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 305 | glTexCoord2f(0.5 - localShift, 0.5); 306 | glVertex3f(-2.*localShift, 0.0, 0.0); 307 | 308 | localShift = i*nrmTriangleSide; 309 | glTexCoord2f(0.5 - localShift, 0.0); 310 | glVertex3f(-2.*localShift, -1.0, 0.0); 311 | } 312 | }; 313 | 314 | glEnd(); 315 | 316 | // Bottom central triangle 317 | glBindTexture(GL_TEXTURE_2D, TextureObject2.Handle); 318 | glBegin(GL_TRIANGLES); 319 | 320 | for (int i=0 ; i < triNum ; i ++) 321 | { 322 | if (this->pattern == TexPattern::All ) 323 | { 324 | // lower right triangles 325 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 326 | glTexCoord2f(leftTexBorder, 1.0); 327 | glVertex3f( 2.*localShift, 0.0, 0.0); 328 | 329 | localShift = nrmHalfTriangleSide + (i+1)*nrmTriangleSide; 330 | glTexCoord2f(rightTexBorder, 1.0); 331 | glVertex3f(2.*localShift, 0.0, 0.0); 332 | 333 | localShift = (i+1)*nrmTriangleSide; 334 | glTexCoord2f(0.5, 0.0); 335 | glVertex3f(2.*localShift, -1.0, 0.0); 336 | 337 | // lower left triangles 338 | localShift = nrmHalfTriangleSide + (i+1)*nrmTriangleSide; 339 | glTexCoord2f(leftTexBorder, 1.0); 340 | glVertex3f(-2.*localShift , 0.0, 0.0); 341 | 342 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 343 | glTexCoord2f(rightTexBorder, 1.0); 344 | glVertex3f( -2.*localShift, 0.0, 0.0); 345 | 346 | localShift = (i+1)*nrmTriangleSide; 347 | glTexCoord2f(0.5, 0.0); 348 | glVertex3f(-2.*localShift, -1.0, 0.0); 349 | } 350 | else 351 | { 352 | // lower right triangles 353 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 354 | glTexCoord2f(0.5 + localShift, 0.5); 355 | glVertex3f( 2.*localShift, 0.0, 0.0); 356 | 357 | localShift = nrmHalfTriangleSide + (i+1)*nrmTriangleSide; 358 | glTexCoord2f(0.5 + localShift, 0.5); 359 | glVertex3f(2.*localShift, 0.0, 0.0); 360 | 361 | localShift = (i+1)*nrmTriangleSide; 362 | glTexCoord2f(0.5 + localShift , 0.0); 363 | glVertex3f(2.*localShift, -1.0, 0.0); 364 | 365 | // lower left triangles 366 | localShift = nrmHalfTriangleSide + (i+1)*nrmTriangleSide; 367 | glTexCoord2f(0.5 - localShift, 0.5); 368 | glVertex3f(-2.*localShift , 0.0, 0.0); 369 | 370 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 371 | glTexCoord2f(0.5 - localShift, 0.5); 372 | glVertex3f( -2.*localShift, 0.0, 0.0); 373 | 374 | localShift = (i+1)*nrmTriangleSide; 375 | glTexCoord2f(0.5 - localShift, 0.0); 376 | glVertex3f(-2.*localShift, -1.0, 0.0); 377 | } 378 | } 379 | 380 | triNum = (double)frameWidth / 2. / triangleSide; 381 | triNum += 1; 382 | for (int i=0 ; i < triNum ; i ++) 383 | { 384 | if ( (i == 0 && this->pattern == TexPattern::WithAdjacents) || this->pattern == TexPattern::All) 385 | { 386 | // upper right triangles /-> 387 | localShift = i*nrmTriangleSide; 388 | glTexCoord2f(leftTexBorder, 1.0); 389 | glVertex3f(2.*localShift , 1., 0.0); 390 | 391 | localShift = (i+1)*nrmTriangleSide; 392 | glTexCoord2f(rightTexBorder, 1.0); 393 | glVertex3f(2.*localShift, 1., 0.0); 394 | 395 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 396 | glTexCoord2f(0.5, 0.); 397 | glVertex3f(2.*localShift, 0.0, 0.0); 398 | 399 | // upper left triangles /<- 400 | localShift = (i+1)*nrmTriangleSide; 401 | glTexCoord2f(leftTexBorder, 1.0); 402 | glVertex3f(-2.*localShift, 1.0, 0.0); 403 | 404 | localShift = i*nrmTriangleSide; 405 | glTexCoord2f(rightTexBorder, 1.0); 406 | glVertex3f(-2.*localShift, 1.0, 0.0); 407 | 408 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 409 | glTexCoord2f(0.5, 0.); 410 | glVertex3f(-2.*localShift, 0.0, 0.0); 411 | } 412 | else 413 | { 414 | // upper right triangles /-> 415 | localShift = i*nrmTriangleSide; 416 | glTexCoord2f(0.5 + localShift , 1.0); 417 | glVertex3f(2.*localShift , 1., 0.0); 418 | 419 | localShift = (i+1)*nrmTriangleSide; 420 | glTexCoord2f(0.5 + localShift, 1.0); 421 | glVertex3f(2.*localShift, 1., 0.0); 422 | 423 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 424 | glTexCoord2f(0.5 + localShift, 0.5); 425 | glVertex3f(2.*localShift, 0.0, 0.0); 426 | 427 | // upper left triangles /<- 428 | localShift = (i+1)*nrmTriangleSide; 429 | glTexCoord2f(0.5 - localShift, 1.0); 430 | glVertex3f(-2.*localShift, 1.0, 0.0); 431 | 432 | localShift = i*nrmTriangleSide; 433 | glTexCoord2f(0.5 - localShift, 1.0); 434 | glVertex3f(-2.*localShift, 1.0, 0.0); 435 | 436 | localShift = nrmHalfTriangleSide + i*nrmTriangleSide; 437 | glTexCoord2f(0.5 - localShift, 0.5); 438 | glVertex3f(-2.*localShift, 0.0, 0.0); 439 | } 440 | }; 441 | 442 | glEnd(); 443 | 444 | glDisable(GL_TEXTURE_2D); 445 | 446 | return FF_SUCCESS; 447 | } 448 | 449 | 450 | DWORD FFGLGeometryMixer::InitGL(const FFGLViewportStruct *vp) 451 | { 452 | return FF_SUCCESS; 453 | } 454 | 455 | DWORD FFGLGeometryMixer::DeInitGL() 456 | { 457 | return FF_SUCCESS; 458 | } 459 | 460 | -------------------------------------------------------------------------------- /FFGLGeometryMixer.h: -------------------------------------------------------------------------------- 1 | #ifndef FFGLGEOMETRYMIXER_H 2 | #define FFGLGEOMETRYMIXER_H 3 | 4 | #include "FFGL/FFGLPluginSDK.h" 5 | #include "FFGL/FFGLLib.h" 6 | 7 | 8 | class FFGLGeometryMixer : public CFreeFrameGLPlugin 9 | { 10 | public: 11 | 12 | enum TexPattern:unsigned char { 13 | SplitAsGeometry = 0, // All triangles use splitted texcoords 14 | OnlyTwoCentral = 1, // Only two central triangles use central texmapping 15 | WithAdjacents = 2, // Two central triangles and four adjacent triangles use central texmapping 16 | All = 3 // All triangles use central texmapping 17 | }; 18 | 19 | FFGLGeometryMixer(void); 20 | ~FFGLGeometryMixer(void); 21 | 22 | 23 | /////////////////////////////////////////////////// 24 | // FreeFrame plugin methods 25 | /////////////////////////////////////////////////// 26 | 27 | DWORD SetParameter(const SetParameterStruct* pParam); 28 | DWORD GetParameter(DWORD dwIndex); 29 | 30 | DWORD ProcessOpenGL(ProcessOpenGLStruct* pGL); 31 | 32 | DWORD InitGL(const FFGLViewportStruct *vp); 33 | DWORD DeInitGL(); 34 | 35 | 36 | 37 | /////////////////////////////////////////////////// 38 | // Factory method 39 | /////////////////////////////////////////////////// 40 | 41 | static DWORD __stdcall CreateInstance(CFreeFrameGLPlugin **ppInstance) 42 | { 43 | *ppInstance = new FFGLGeometryMixer(); 44 | if (*ppInstance != NULL) return FF_SUCCESS; 45 | return FF_FAIL; 46 | } 47 | 48 | private: 49 | // Parameters 50 | float m_blend; 51 | TexPattern pattern; 52 | 53 | // Effects implementation 54 | DWORD TriangleMeshMix(ProcessOpenGLStruct* pGL); 55 | 56 | DWORD ScalableTriangleMeshMix(ProcessOpenGLStruct* pGL); 57 | 58 | 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /FFGLGeometryMixer.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {D028357D-EE31-446F-B99A-EA6F21D636B5} 15 | FFGLGeometryMixer 16 | FFGLTriangleMixer 17 | 18 | 19 | 20 | DynamicLibrary 21 | true 22 | MultiByte 23 | 24 | 25 | DynamicLibrary 26 | false 27 | MultiByte 28 | false 29 | false 30 | v100 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | false 45 | 46 | 47 | 48 | Level3 49 | Disabled 50 | ProgramDatabase 51 | true 52 | WIN32;_DEBUG;_WINDOWS;_USRDLL;FFGLTILE_EXPORTS;%(PreprocessorDefinitions) 53 | Default 54 | 55 | 56 | true 57 | FFGLPlugins.def 58 | OpenGL32.lib;%(AdditionalDependencies) 59 | Windows 60 | false 61 | true 62 | 63 | 64 | 65 | 66 | Level3 67 | Disabled 68 | 69 | 70 | true 71 | WIN32;_DEBUG;_WINDOWS;_USRDLL;FFGLTILE_EXPORTS;%(PreprocessorDefinitions) 72 | true 73 | Default 74 | 75 | 76 | 77 | 78 | false 79 | true 80 | true 81 | OpenGL32.lib 82 | FFGLPlugins.def 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /FFGLGeometryMixer.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {712569ec-396c-4a7d-b031-829fac146a44} 18 | 19 | 20 | {43536f96-7053-4859-8e0c-4765cd58dfb1} 21 | 22 | 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files\FFGL 29 | 30 | 31 | Header Files\FFGL 32 | 33 | 34 | Header Files\FFGL 35 | 36 | 37 | Header Files\FFGL 38 | 39 | 40 | Header Files\FFGL 41 | 42 | 43 | Header Files\FFGL 44 | 45 | 46 | Header Files\FFGL 47 | 48 | 49 | Header Files\FFGL 50 | 51 | 52 | Header Files\FFGL 53 | 54 | 55 | Header Files\FFGL 56 | 57 | 58 | 59 | 60 | Source Files 61 | 62 | 63 | Source Files\FFGL 64 | 65 | 66 | Source Files\FFGL 67 | 68 | 69 | Source Files\FFGL 70 | 71 | 72 | Source Files\FFGL 73 | 74 | 75 | Source Files\FFGL 76 | 77 | 78 | -------------------------------------------------------------------------------- /FFGLPlugins.def: -------------------------------------------------------------------------------- 1 | 2 | EXPORTS plugMain 3 | -------------------------------------------------------------------------------- /FFGLTriangleMixer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FFGLGeometryMixer", "FFGLGeometryMixer.vcxproj", "{D028357D-EE31-446F-B99A-EA6F21D636B5}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {D028357D-EE31-446F-B99A-EA6F21D636B5}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {D028357D-EE31-446F-B99A-EA6F21D636B5}.Debug|Win32.Build.0 = Debug|Win32 14 | {D028357D-EE31-446F-B99A-EA6F21D636B5}.Release|Win32.ActiveCfg = Release|Win32 15 | {D028357D-EE31-446F-B99A-EA6F21D636B5}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /MacOSX/FFGLProject.xcconfig: -------------------------------------------------------------------------------- 1 | 2 | GCC_PREPROCESSOR_DEFINITIONS = $(PREPROCESSOR_BASE) 3 | 4 | OTHER_LDFLAGS = $(LINKER_FLAGS) 5 | 6 | SDKROOT = macosx 7 | MACOSX_DEPLOYMENT_TARGET = 10.7 8 | ARCHS = $(ARCHS_STANDARD_32_BIT) 9 | 10 | ONLY_ACTIVE_ARCH = YES 11 | 12 | LINKER_FLAGS = -framework OpenGL -framework Carbon -framework AppKit 13 | 14 | PREPROCESSOR_BASE = TARGET_OS_MAC=1 -------------------------------------------------------------------------------- /MacOSX/FFGLTriangeMixer.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MacOSX/FFGLTriangeMixer.xcodeproj/project.xcworkspace/xcshareddata/FFGLTriangeMixer.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | D84EFE63-EF25-4E73-BDD4-884D4FB4E71C 9 | IDESourceControlProjectName 10 | FFGLTriangeMixer 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | EE3D58E1463240417F29CAC5FE3991ADA5148698 14 | https://github.com/OlegPotiy/FFGLTriangleMX 15 | 16 | IDESourceControlProjectPath 17 | MacOSX/FFGLTriangeMixer.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | EE3D58E1463240417F29CAC5FE3991ADA5148698 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/OlegPotiy/FFGLTriangleMX 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | EE3D58E1463240417F29CAC5FE3991ADA5148698 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | EE3D58E1463240417F29CAC5FE3991ADA5148698 36 | IDESourceControlWCCName 37 | FFGLTriangleMX 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TriangleMX FFGL mixer plugin 2 | ============== 3 | TriangleMX is a FreeFrameGL mixer plugin for FFGL-hosts like Resolume Arena. 4 | 5 | TriangleMX mixer combines two video layers using triangle mesh pattern. The screen area is divided into two triangle strips and every triangle is textured with curtain input layer. Blending factor controls texture mapping for different triangles (see docs and demos for details). 6 | 7 | The mixer idea was borrowed from Vadim Epstein (vj Eps) demo «Secret in their eyes» (http://vimeo.com/63057090). 8 | 9 | Docs: http://github.com/OlegPotiy/FFGLTriangleMX/tree/master/Docs 10 | 11 | Binary: http://github.com/OlegPotiy/FFGLTriangleMX/tree/master/Bins 12 | 13 | Some demos/concepts: http://vimeo.com/85140944, http://vimeo.com/84898044 14 | 15 | --------------------------------------------------------------------------------