diff --git a/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj b/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj index 802b0024bb..effade6116 100644 --- a/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj +++ b/extras/JuceDemo/Builds/MacOSX/Juce Demo.xcodeproj/project.pbxproj @@ -386,6 +386,7 @@ 575587359A2F65312CE97AC4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_graphics.mm"; path = "../../../../modules/juce_graphics/juce_graphics.mm"; sourceTree = "SOURCE_ROOT"; }; 579D22DA6ECC930E19B7104A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = BinaryData.cpp; path = ../../JuceLibraryCode/BinaryData.cpp; sourceTree = "SOURCE_ROOT"; }; 58061ADC1867C814A334D49D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_FileInputStream.cpp"; path = "../../../../modules/juce_core/files/juce_FileInputStream.cpp"; sourceTree = "SOURCE_ROOT"; }; + 58864C3D7F369EBE01E42C5C = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_OpenGLShaderProgram.cpp"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp"; sourceTree = "SOURCE_ROOT"; }; 591E3F5832C08B0841971B01 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PropertyComponent.cpp"; path = "../../../../modules/juce_gui_basics/properties/juce_PropertyComponent.cpp"; sourceTree = "SOURCE_ROOT"; }; 59591325C73706DB6BD2C887 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FilePreviewComponent.h"; path = "../../../../modules/juce_gui_basics/filebrowser/juce_FilePreviewComponent.h"; sourceTree = "SOURCE_ROOT"; }; 5996F037CD5993251871573E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DrawableShape.cpp"; path = "../../../../modules/juce_gui_basics/drawables/juce_DrawableShape.cpp"; sourceTree = "SOURCE_ROOT"; }; @@ -527,6 +528,7 @@ 8391251872CF6C7C11F11EEC = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Identifier.cpp"; path = "../../../../modules/juce_core/text/juce_Identifier.cpp"; sourceTree = "SOURCE_ROOT"; }; 83D67DD10BD2ACDC0984ADCB = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = InterprocessCommsDemo.cpp; path = ../../Source/demos/InterprocessCommsDemo.cpp; sourceTree = "SOURCE_ROOT"; }; 840EF2C371FCC5690DA216F6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_SHA256.h"; path = "../../../../modules/juce_cryptography/hashing/juce_SHA256.h"; sourceTree = "SOURCE_ROOT"; }; + 8565630D87FEE505D50CE2EF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLExtensions.h"; path = "../../../../modules/juce_opengl/native/juce_OpenGLExtensions.h"; sourceTree = "SOURCE_ROOT"; }; 85D1779E60213BC6670E2C75 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringArray.h"; path = "../../../../modules/juce_core/text/juce_StringArray.h"; sourceTree = "SOURCE_ROOT"; }; 8603713AFBC316218045A963 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MemoryInputStream.cpp"; path = "../../../../modules/juce_core/streams/juce_MemoryInputStream.cpp"; sourceTree = "SOURCE_ROOT"; }; 868D4BEF6B94EB7BF659CF01 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_core.mm"; path = "../../../../modules/juce_core/juce_core.mm"; sourceTree = "SOURCE_ROOT"; }; @@ -558,6 +560,7 @@ 8E6E18125D1046B97EF7AEE2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PreferencesPanel.cpp"; path = "../../../../modules/juce_gui_extra/misc/juce_PreferencesPanel.cpp"; sourceTree = "SOURCE_ROOT"; }; 8E7F5F80EB6D99EED152A465 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_AudioUnitPluginFormat.mm"; path = "../../../../modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm"; sourceTree = "SOURCE_ROOT"; }; 8EB9B4853F225BDB97D6626E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_CoreGraphicsContext.mm"; path = "../../../../modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm"; sourceTree = "SOURCE_ROOT"; }; + 8EEB4DEB11F3DF01BA6F7528 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLShaderProgram.h"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h"; sourceTree = "SOURCE_ROOT"; }; 8F1D89D1349B0DCC115B5D47 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_Threads.cpp"; path = "../../../../modules/juce_core/native/juce_win32_Threads.cpp"; sourceTree = "SOURCE_ROOT"; }; 8F37F4E9DB8E42EDF29DE166 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CameraDemo.cpp; path = ../../Source/demos/CameraDemo.cpp; sourceTree = "SOURCE_ROOT"; }; 904B316152B6C23112E0A0B1 = { isa = PBXFileReference; lastKnownFileType = file; name = "juce_module_info"; path = "../../../../modules/juce_audio_processors/juce_module_info"; sourceTree = "SOURCE_ROOT"; }; @@ -1903,6 +1906,8 @@ 17422D876DAAF091ED089B8D, B81FA2ED22BCC03D124031ED, 942191F317B1B2B1CFBB7C60, + 58864C3D7F369EBE01E42C5C, + 8EEB4DEB11F3DF01BA6F7528, FE9A5898294228EB7F439951, 4CFB262AA9778621B8B33A7D, EC89003BF30329181BB3EA4B, @@ -1912,6 +1917,7 @@ ED9FAEA9116C568942BAD000, 6E1CFF5227B2F2E200DD9EC7, AE394742FA0F2C6AA39906DD, + 8565630D87FEE505D50CE2EF, D66048AF1E05FF836B2A813A ); name = native; sourceTree = ""; }; 7CFCB9A92FB574419734C1F5 = { isa = PBXGroup; children = ( EB8917291F41B7345B13B53E, diff --git a/extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj b/extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj index 7ee8b33e25..b19911fde8 100644 --- a/extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj +++ b/extras/JuceDemo/Builds/VisualStudio2005/Juce Demo.vcproj @@ -4311,6 +4311,17 @@ + + + + + + + + + @@ -4348,6 +4359,7 @@ + diff --git a/extras/JuceDemo/Builds/VisualStudio2008/Juce Demo.vcproj b/extras/JuceDemo/Builds/VisualStudio2008/Juce Demo.vcproj index 940b8d34d4..158a5c4ad7 100644 --- a/extras/JuceDemo/Builds/VisualStudio2008/Juce Demo.vcproj +++ b/extras/JuceDemo/Builds/VisualStudio2008/Juce Demo.vcproj @@ -4311,6 +4311,17 @@ + + + + + + + + + @@ -4348,6 +4359,7 @@ + diff --git a/extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj b/extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj index a97d04e0af..3d60c4048d 100644 --- a/extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj +++ b/extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj @@ -1157,6 +1157,9 @@ true + + true + true @@ -1607,9 +1610,11 @@ + + diff --git a/extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj.filters b/extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj.filters index 22ca523de8..0ec80122b4 100644 --- a/extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj.filters +++ b/extras/JuceDemo/Builds/VisualStudio2010/Juce Demo.vcxproj.filters @@ -1510,6 +1510,9 @@ Juce Modules\juce_opengl\opengl + + Juce Modules\juce_opengl\opengl + Juce Modules\juce_opengl\opengl @@ -2826,6 +2829,9 @@ Juce Modules\juce_opengl\opengl + + Juce Modules\juce_opengl\opengl + Juce Modules\juce_opengl\opengl @@ -2835,6 +2841,9 @@ Juce Modules\juce_opengl\opengl + + Juce Modules\juce_opengl\native + Juce Modules\juce_opengl diff --git a/extras/JuceDemo/Builds/iOS/Juce Demo.xcodeproj/project.pbxproj b/extras/JuceDemo/Builds/iOS/Juce Demo.xcodeproj/project.pbxproj index b4808b0244..c54282fa69 100644 --- a/extras/JuceDemo/Builds/iOS/Juce Demo.xcodeproj/project.pbxproj +++ b/extras/JuceDemo/Builds/iOS/Juce Demo.xcodeproj/project.pbxproj @@ -379,6 +379,7 @@ 575587359A2F65312CE97AC4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_graphics.mm"; path = "../../../../modules/juce_graphics/juce_graphics.mm"; sourceTree = "SOURCE_ROOT"; }; 579D22DA6ECC930E19B7104A = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = BinaryData.cpp; path = ../../JuceLibraryCode/BinaryData.cpp; sourceTree = "SOURCE_ROOT"; }; 58061ADC1867C814A334D49D = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_FileInputStream.cpp"; path = "../../../../modules/juce_core/files/juce_FileInputStream.cpp"; sourceTree = "SOURCE_ROOT"; }; + 58864C3D7F369EBE01E42C5C = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_OpenGLShaderProgram.cpp"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp"; sourceTree = "SOURCE_ROOT"; }; 591E3F5832C08B0841971B01 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PropertyComponent.cpp"; path = "../../../../modules/juce_gui_basics/properties/juce_PropertyComponent.cpp"; sourceTree = "SOURCE_ROOT"; }; 59591325C73706DB6BD2C887 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_FilePreviewComponent.h"; path = "../../../../modules/juce_gui_basics/filebrowser/juce_FilePreviewComponent.h"; sourceTree = "SOURCE_ROOT"; }; 5996F037CD5993251871573E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_DrawableShape.cpp"; path = "../../../../modules/juce_gui_basics/drawables/juce_DrawableShape.cpp"; sourceTree = "SOURCE_ROOT"; }; @@ -520,6 +521,7 @@ 8391251872CF6C7C11F11EEC = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Identifier.cpp"; path = "../../../../modules/juce_core/text/juce_Identifier.cpp"; sourceTree = "SOURCE_ROOT"; }; 83D67DD10BD2ACDC0984ADCB = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = InterprocessCommsDemo.cpp; path = ../../Source/demos/InterprocessCommsDemo.cpp; sourceTree = "SOURCE_ROOT"; }; 840EF2C371FCC5690DA216F6 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_SHA256.h"; path = "../../../../modules/juce_cryptography/hashing/juce_SHA256.h"; sourceTree = "SOURCE_ROOT"; }; + 8565630D87FEE505D50CE2EF = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLExtensions.h"; path = "../../../../modules/juce_opengl/native/juce_OpenGLExtensions.h"; sourceTree = "SOURCE_ROOT"; }; 85D1779E60213BC6670E2C75 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_StringArray.h"; path = "../../../../modules/juce_core/text/juce_StringArray.h"; sourceTree = "SOURCE_ROOT"; }; 8603713AFBC316218045A963 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_MemoryInputStream.cpp"; path = "../../../../modules/juce_core/streams/juce_MemoryInputStream.cpp"; sourceTree = "SOURCE_ROOT"; }; 868D4BEF6B94EB7BF659CF01 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_core.mm"; path = "../../../../modules/juce_core/juce_core.mm"; sourceTree = "SOURCE_ROOT"; }; @@ -550,6 +552,7 @@ 8E6E18125D1046B97EF7AEE2 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PreferencesPanel.cpp"; path = "../../../../modules/juce_gui_extra/misc/juce_PreferencesPanel.cpp"; sourceTree = "SOURCE_ROOT"; }; 8E7F5F80EB6D99EED152A465 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_AudioUnitPluginFormat.mm"; path = "../../../../modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm"; sourceTree = "SOURCE_ROOT"; }; 8EB9B4853F225BDB97D6626E = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_CoreGraphicsContext.mm"; path = "../../../../modules/juce_graphics/native/juce_mac_CoreGraphicsContext.mm"; sourceTree = "SOURCE_ROOT"; }; + 8EEB4DEB11F3DF01BA6F7528 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLShaderProgram.h"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h"; sourceTree = "SOURCE_ROOT"; }; 8F1D89D1349B0DCC115B5D47 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_Threads.cpp"; path = "../../../../modules/juce_core/native/juce_win32_Threads.cpp"; sourceTree = "SOURCE_ROOT"; }; 8F37F4E9DB8E42EDF29DE166 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = CameraDemo.cpp; path = ../../Source/demos/CameraDemo.cpp; sourceTree = "SOURCE_ROOT"; }; 904B316152B6C23112E0A0B1 = { isa = PBXFileReference; lastKnownFileType = file; name = "juce_module_info"; path = "../../../../modules/juce_audio_processors/juce_module_info"; sourceTree = "SOURCE_ROOT"; }; @@ -1893,6 +1896,8 @@ 17422D876DAAF091ED089B8D, B81FA2ED22BCC03D124031ED, 942191F317B1B2B1CFBB7C60, + 58864C3D7F369EBE01E42C5C, + 8EEB4DEB11F3DF01BA6F7528, FE9A5898294228EB7F439951, 4CFB262AA9778621B8B33A7D, EC89003BF30329181BB3EA4B, @@ -1902,6 +1907,7 @@ ED9FAEA9116C568942BAD000, 6E1CFF5227B2F2E200DD9EC7, AE394742FA0F2C6AA39906DD, + 8565630D87FEE505D50CE2EF, D66048AF1E05FF836B2A813A ); name = native; sourceTree = ""; }; 7CFCB9A92FB574419734C1F5 = { isa = PBXGroup; children = ( EB8917291F41B7345B13B53E, diff --git a/extras/audio plugin host/Builds/MacOSX/Plugin Host.xcodeproj/project.pbxproj b/extras/audio plugin host/Builds/MacOSX/Plugin Host.xcodeproj/project.pbxproj index ecc405ef0c..1028890131 100644 --- a/extras/audio plugin host/Builds/MacOSX/Plugin Host.xcodeproj/project.pbxproj +++ b/extras/audio plugin host/Builds/MacOSX/Plugin Host.xcodeproj/project.pbxproj @@ -284,6 +284,7 @@ 43ABAFF6AEA0A0C39A0E61DA = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_win32_ActiveXComponent.cpp"; path = "../../../../modules/juce_gui_extra/native/juce_win32_ActiveXComponent.cpp"; sourceTree = "SOURCE_ROOT"; }; 43D23C18695F24F9A3DFA7B4 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_OpenGLFrameBuffer.cpp"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp"; sourceTree = "SOURCE_ROOT"; }; 4420BE21E3F857BA1FFE7E1A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_GlyphArrangement.h"; path = "../../../../modules/juce_graphics/fonts/juce_GlyphArrangement.h"; sourceTree = "SOURCE_ROOT"; }; + 442E6311FB54378E88B6811C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLShaderProgram.h"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h"; sourceTree = "SOURCE_ROOT"; }; 44AF5FE624EC693DC25C453C = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_android_Audio.cpp"; path = "../../../../modules/juce_audio_devices/native/juce_android_Audio.cpp"; sourceTree = "SOURCE_ROOT"; }; 44B8CAEA9946E2D8B72B85FB = { isa = PBXFileReference; lastKnownFileType = file; name = "juce_module_info"; path = "../../../../modules/juce_cryptography/juce_module_info"; sourceTree = "SOURCE_ROOT"; }; 45200F793669CADC5D279093 = { isa = PBXFileReference; lastKnownFileType = file; name = "juce_module_info"; path = "../../../../modules/juce_graphics/juce_module_info"; sourceTree = "SOURCE_ROOT"; }; @@ -495,6 +496,7 @@ 8B9FDF0245BB8A4AA9996C3C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Synthesiser.h"; path = "../../../../modules/juce_audio_basics/synthesisers/juce_Synthesiser.h"; sourceTree = "SOURCE_ROOT"; }; 8BA1AF085755958342C9213A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLPixelFormat.h"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLPixelFormat.h"; sourceTree = "SOURCE_ROOT"; }; 8BD050801C810B95634B6326 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OwnedArray.h"; path = "../../../../modules/juce_core/containers/juce_OwnedArray.h"; sourceTree = "SOURCE_ROOT"; }; + 8BD67EC10CC86AB4DB096E5D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLExtensions.h"; path = "../../../../modules/juce_opengl/native/juce_OpenGLExtensions.h"; sourceTree = "SOURCE_ROOT"; }; 8C45248B3DA51C23552039C7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Memory.h"; path = "../../../../modules/juce_core/memory/juce_Memory.h"; sourceTree = "SOURCE_ROOT"; }; 8CB152030AF66AD83C910064 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ResizableEdgeComponent.h"; path = "../../../../modules/juce_gui_basics/layout/juce_ResizableEdgeComponent.h"; sourceTree = "SOURCE_ROOT"; }; 8CC281F3463EE9BCA6379E81 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PNGLoader.cpp"; path = "../../../../modules/juce_graphics/image_formats/juce_PNGLoader.cpp"; sourceTree = "SOURCE_ROOT"; }; @@ -772,6 +774,7 @@ DEEFCE87BE3B9D7AFC7ADC16 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ApplicationCommandInfo.cpp"; path = "../../../../modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.cpp"; sourceTree = "SOURCE_ROOT"; }; DF309886A3D26FC34280B329 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_CameraDevice.mm"; path = "../../../../modules/juce_video/native/juce_mac_CameraDevice.mm"; sourceTree = "SOURCE_ROOT"; }; DF614EDBEA2D76889E002465 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_linux_SystemTrayIcon.cpp"; path = "../../../../modules/juce_gui_extra/native/juce_linux_SystemTrayIcon.cpp"; sourceTree = "SOURCE_ROOT"; }; + DFE18134F58A9C546AD16FF7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_OpenGLShaderProgram.cpp"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp"; sourceTree = "SOURCE_ROOT"; }; DFF6CC63DE1396FE7E540246 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_DocumentWindow.h"; path = "../../../../modules/juce_gui_basics/windows/juce_DocumentWindow.h"; sourceTree = "SOURCE_ROOT"; }; E000EB4363C6887897FB457C = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_URL.h"; path = "../../../../modules/juce_core/network/juce_URL.h"; sourceTree = "SOURCE_ROOT"; }; E01C957605B8B074A13A5442 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_Drawable.h"; path = "../../../../modules/juce_gui_basics/drawables/juce_Drawable.h"; sourceTree = "SOURCE_ROOT"; }; @@ -1825,6 +1828,8 @@ 4CE76ABC51CC5E019AED3C2B, 8BA1AF085755958342C9213A, 597D5688E23397FE09F53BA3, + DFE18134F58A9C546AD16FF7, + 442E6311FB54378E88B6811C, 651055751E902F40B83EFD55, 09089786B542AEB678DDE38F, A1DC3C215187E6DD24DD7330, @@ -1834,6 +1839,7 @@ 6E673B706EA21387275F30FD, D4CC4DE44C44AEE40085ACD7, 1668565234C6F9C31363BBE2, + 8BD67EC10CC86AB4DB096E5D, 7916CA65827E16B3775C4952 ); name = native; sourceTree = ""; }; 2C43A64E61A92F2912632BD6 = { isa = PBXGroup; children = ( E23F6FDE88C4164420DC07F6, diff --git a/extras/audio plugin host/Builds/VisualStudio2005/Plugin Host.vcproj b/extras/audio plugin host/Builds/VisualStudio2005/Plugin Host.vcproj index 022f781c79..ce997298dd 100644 --- a/extras/audio plugin host/Builds/VisualStudio2005/Plugin Host.vcproj +++ b/extras/audio plugin host/Builds/VisualStudio2005/Plugin Host.vcproj @@ -4234,6 +4234,17 @@ + + + + + + + + + @@ -4271,6 +4282,7 @@ + diff --git a/extras/audio plugin host/Builds/VisualStudio2008/Plugin Host.vcproj b/extras/audio plugin host/Builds/VisualStudio2008/Plugin Host.vcproj index e0edcaf63e..2329380284 100644 --- a/extras/audio plugin host/Builds/VisualStudio2008/Plugin Host.vcproj +++ b/extras/audio plugin host/Builds/VisualStudio2008/Plugin Host.vcproj @@ -4234,6 +4234,17 @@ + + + + + + + + + @@ -4271,6 +4282,7 @@ + diff --git a/extras/static library/Builds/MacOSX/juce.xcodeproj/project.pbxproj b/extras/static library/Builds/MacOSX/juce.xcodeproj/project.pbxproj index db87e68415..9a50976595 100644 --- a/extras/static library/Builds/MacOSX/juce.xcodeproj/project.pbxproj +++ b/extras/static library/Builds/MacOSX/juce.xcodeproj/project.pbxproj @@ -104,6 +104,7 @@ 1BD4A4D61D4C3F3D142B1662 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_MainMenu.mm"; path = "../../../../modules/juce_gui_basics/native/juce_mac_MainMenu.mm"; sourceTree = "SOURCE_ROOT"; }; 1BD7DBC48F6BEAD09054FD7F = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Label.cpp"; path = "../../../../modules/juce_gui_basics/widgets/juce_Label.cpp"; sourceTree = "SOURCE_ROOT"; }; 1BE43FB3C7B4D333AEC3A815 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_EdgeTable.h"; path = "../../../../modules/juce_graphics/geometry/juce_EdgeTable.h"; sourceTree = "SOURCE_ROOT"; }; + 1DC59B4A97D5DF77801ACAE8 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_OpenGLShaderProgram.cpp"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp"; sourceTree = "SOURCE_ROOT"; }; 1DFB6A05551154B15FE6AC50 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_android_CameraDevice.cpp"; path = "../../../../modules/juce_video/native/juce_android_CameraDevice.cpp"; sourceTree = "SOURCE_ROOT"; }; 1E2FA777B3F7449B81F2A951 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_CharPointer_UTF32.h"; path = "../../../../modules/juce_core/text/juce_CharPointer_UTF32.h"; sourceTree = "SOURCE_ROOT"; }; 1E56E15EC4C962B323A2F926 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_PathIterator.h"; path = "../../../../modules/juce_graphics/geometry/juce_PathIterator.h"; sourceTree = "SOURCE_ROOT"; }; @@ -774,6 +775,7 @@ F137AE2B36202827756A577A = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_MemoryMappedFile.h"; path = "../../../../modules/juce_core/files/juce_MemoryMappedFile.h"; sourceTree = "SOURCE_ROOT"; }; F13CEEB19F05F090CF2151DC = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_AudioCDReader.h"; path = "../../../../modules/juce_audio_devices/audio_cd/juce_AudioCDReader.h"; sourceTree = "SOURCE_ROOT"; }; F1E2795D2366C2A9F9B4E08F = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ActionBroadcaster.h"; path = "../../../../modules/juce_events/broadcasters/juce_ActionBroadcaster.h"; sourceTree = "SOURCE_ROOT"; }; + F28767C5606E63E66146E375 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLExtensions.h"; path = "../../../../modules/juce_opengl/native/juce_OpenGLExtensions.h"; sourceTree = "SOURCE_ROOT"; }; F32627C277EB3422D4DDB41D = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_MidiInput.h"; path = "../../../../modules/juce_audio_devices/midi_io/juce_MidiInput.h"; sourceTree = "SOURCE_ROOT"; }; F3C526756D49C88DA3110221 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "juce_mac_FileChooser.mm"; path = "../../../../modules/juce_gui_basics/native/juce_mac_FileChooser.mm"; sourceTree = "SOURCE_ROOT"; }; F3FF4B3C372619CEF134B522 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_PropertySet.cpp"; path = "../../../../modules/juce_core/containers/juce_PropertySet.cpp"; sourceTree = "SOURCE_ROOT"; }; @@ -786,6 +788,7 @@ F67830F82C071DEDFE0B43A9 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_posix_SharedCode.h"; path = "../../../../modules/juce_core/native/juce_posix_SharedCode.h"; sourceTree = "SOURCE_ROOT"; }; F687E441210FEB4EEFB0CC33 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_SpinLock.h"; path = "../../../../modules/juce_core/threads/juce_SpinLock.h"; sourceTree = "SOURCE_ROOT"; }; F68ED837371C2CA43A42793F = { isa = PBXFileReference; lastKnownFileType = file; name = "juce_module_info"; path = "../../../../modules/juce_graphics/juce_module_info"; sourceTree = "SOURCE_ROOT"; }; + F7010D646D19C704DE9D42A1 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_OpenGLShaderProgram.h"; path = "../../../../modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h"; sourceTree = "SOURCE_ROOT"; }; F741F678F4394466750DBCF0 = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_Expression.cpp"; path = "../../../../modules/juce_core/maths/juce_Expression.cpp"; sourceTree = "SOURCE_ROOT"; }; F769353495D4D50DB4B0DC31 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "juce_ArrowButton.h"; path = "../../../../modules/juce_gui_basics/buttons/juce_ArrowButton.h"; sourceTree = "SOURCE_ROOT"; }; F7D11568291BA9EA434B7CFB = { isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = "juce_ComponentListener.cpp"; path = "../../../../modules/juce_gui_basics/components/juce_ComponentListener.cpp"; sourceTree = "SOURCE_ROOT"; }; @@ -1744,6 +1747,8 @@ 7251827C30AC1C4F55C3DB69, 6D95302F8D68BA3F0538214F, 9E067C6101B6E2D11365EBDC, + 1DC59B4A97D5DF77801ACAE8, + F7010D646D19C704DE9D42A1, A0D54F01BC8018CC41FA34E9, 53B9B6090EDB9B6E0FA8577F, 154C4985C134E2B4A7B87025, @@ -1753,6 +1758,7 @@ BFBA3FCA1C3F9FD3BB8146B8, 5DB822375EE0E803E8E448D4, 3682BBAEC6842DE49899AEF0, + F28767C5606E63E66146E375, 39373A988D28974E62BE9DC5 ); name = native; sourceTree = ""; }; 9CAD7248065B9A6C050F9527 = { isa = PBXGroup; children = ( 543980D718ACBB76513A4AF0, diff --git a/extras/static library/Builds/VisualStudio2008/juce.vcproj b/extras/static library/Builds/VisualStudio2008/juce.vcproj index e90f581209..6649a8f544 100644 --- a/extras/static library/Builds/VisualStudio2008/juce.vcproj +++ b/extras/static library/Builds/VisualStudio2008/juce.vcproj @@ -4125,6 +4125,17 @@ + + + + + + + + + @@ -4162,6 +4173,7 @@ + diff --git a/extras/static library/Builds/VisualStudio2010/juce.vcxproj b/extras/static library/Builds/VisualStudio2010/juce.vcxproj index c848dda266..15afd485a9 100644 --- a/extras/static library/Builds/VisualStudio2010/juce.vcxproj +++ b/extras/static library/Builds/VisualStudio2010/juce.vcxproj @@ -1120,6 +1120,9 @@ true + + true + true @@ -1553,9 +1556,11 @@ + + diff --git a/extras/static library/Builds/VisualStudio2010/juce.vcxproj.filters b/extras/static library/Builds/VisualStudio2010/juce.vcxproj.filters index eb3fa10bd2..5069fa7e71 100644 --- a/extras/static library/Builds/VisualStudio2010/juce.vcxproj.filters +++ b/extras/static library/Builds/VisualStudio2010/juce.vcxproj.filters @@ -1396,6 +1396,9 @@ Juce Modules\juce_opengl\opengl + + Juce Modules\juce_opengl\opengl + Juce Modules\juce_opengl\opengl @@ -2661,6 +2664,9 @@ Juce Modules\juce_opengl\opengl + + Juce Modules\juce_opengl\opengl + Juce Modules\juce_opengl\opengl @@ -2670,6 +2676,9 @@ Juce Modules\juce_opengl\opengl + + Juce Modules\juce_opengl\native + Juce Modules\juce_opengl diff --git a/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp index 04bbfe8f81..810d266441 100644 --- a/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_MP3AudioFormat.cpp @@ -344,13 +344,13 @@ const int16 huffmanTab24[] = -1,51,20,-9,-5,-1,65,-1,4,64,-1,35,50,-1,19,49,-7,-5,-3,-1,3,48,34,18,-1,33,-1,2,32,-3,-1,17,1,-1,16,0 }; -struct newhuff +struct BitsToTableMap { - uint32 linbits; + uint32 bits; const int16* table; }; -const newhuff huffmanTables1[] = +const BitsToTableMap huffmanTables1[] = { { 0, huffmanTab0 }, { 0, huffmanTab1 }, { 0, huffmanTab2 }, { 0, huffmanTab3 }, { 0, huffmanTab0 }, { 0, huffmanTab5 }, { 0, huffmanTab6 }, { 0, huffmanTab7 }, @@ -365,7 +365,7 @@ const newhuff huffmanTables1[] = const int16 huffmanTabC0[] = { -29,-21,-13,-7,-3,-1,11,15,-1,13,14,-3,-1,7,5,9,-3,-1,6,3,-1,10,12,-3,-1,2,1,-1,4,8,0 }; const int16 huffmanTabC1[] = { -15,-7,-3,-1,15,14,-1,13,12,-3,-1,11,10,-1,9,8,-7,-3,-1,7,6,-1,5,4,-3,-1,3,2,-1,1,0 }; -const newhuff huffmanTables2[] = { { 0, huffmanTabC0 }, { 0, huffmanTabC1 } }; +const BitsToTableMap huffmanTables2[] = { { 0, huffmanTabC0 }, { 0, huffmanTabC1 } }; //============================================================================== struct VBRTagData @@ -443,27 +443,11 @@ struct VBRTagData } headersize = ((type + 1) * 72000 * bitrate) / sampleRate; - - data += 21; - int encoderDelay = data[0] << 4; - encoderDelay += data[1] >> 4; - int encoderPadding = (data[1] & 15) << 8; - encoderPadding += data[2]; - - if (encoderDelay < 0 || encoderDelay > 3000) - encoderDelay = -1; - - if (encoderPadding < 0 || encoderPadding > 3000) - encoderPadding = -1; - - encoderDelay = encoderDelay; - encoderPadding = encoderPadding; return true; } uint8 toc[100]; - int sampleRate, flags, frames, bytes, vbrScale; - int headersize, encoderDelay, encoderPadding; + int sampleRate, flags, frames, bytes, vbrScale, headersize; private: static bool isVbrTag (const uint8* const d) noexcept @@ -634,22 +618,14 @@ private: { if (table < decodeWin + 512 + 16) table[16] = table[0] = (float) (decodeWindow[j] * scaleval); - if (i % 32 == 31) - table -= 1023; - if (i % 64 == 63) - scaleval = -scaleval; + + if (i % 32 == 31) table -= 1023; + if (i % 64 == 63) scaleval = -scaleval; } } void initLayer2Tables() { - static const double mulmul[27] = - { - 0, -2.0 / 3.0, 2.0 / 3.0, 2.0 / 7.0, 2.0 / 15.0, 2.0 / 31.0, 2.0 / 63.0, 2.0 / 127.0, 2.0 / 255.0, - 2.0 / 511.0, 2.0 / 1023.0, 2.0 / 2047.0, 2.0 / 4095.0, 2.0 / 8191.0, 2.0 / 16383.0, 2.0 / 32767.0, 2.0 / 65535.0, - -4.0 / 5.0, -2.0 / 5.0, 2.0 / 5.0, 4.0 / 5.0, -8.0 / 9.0, -4.0 / 9.0, -2.0 / 9.0, 2.0 / 9.0, 4.0 / 9.0, 8.0 / 9.0 - }; - static const uint8 base[3][9] = { { 1, 0, 2 }, @@ -657,30 +633,36 @@ private: { 21, 1, 22, 23, 0, 24, 25, 2, 26 } }; - static const int tablen[3] = { 3, 5, 9 }; - static uint8* tables[3] = { group3tab, group5tab, group9tab }; + static const int tableLengths[] = { 3, 5, 9 }; + static uint8* tables[] = { group3tab, group5tab, group9tab }; for (int i = 0; i < 3; ++i) { - uint8* itable = tables[i]; - const int len = tablen[i]; + uint8* table = tables[i]; + const int len = tableLengths[i]; for (int j = 0; j < len; ++j) for (int k = 0; k < len; ++k) for (int l = 0; l < len; ++l) { - *itable++ = base[i][l]; - *itable++ = base[i][k]; - *itable++ = base[i][j]; + *table++ = base[i][l]; + *table++ = base[i][k]; + *table++ = base[i][j]; } } for (int k = 0; k < 27; ++k) { - const double m = mulmul[k]; + static const double multipliers[] = + { + 0, -2.0 / 3.0, 2.0 / 3.0, 2.0 / 7.0, 2.0 / 15.0, 2.0 / 31.0, 2.0 / 63.0, 2.0 / 127.0, 2.0 / 255.0, + 2.0 / 511.0, 2.0 / 1023.0, 2.0 / 2047.0, 2.0 / 4095.0, 2.0 / 8191.0, 2.0 / 16383.0, 2.0 / 32767.0, 2.0 / 65535.0, + -4.0 / 5.0, -2.0 / 5.0, 2.0 / 5.0, 4.0 / 5.0, -8.0 / 9.0, -4.0 / 9.0, -2.0 / 9.0, 2.0 / 9.0, 4.0 / 9.0, 8.0 / 9.0 + }; + float* table = muls[k]; for (int j = 3, i = 0; i < 63; ++i, --j) - *table++ = (float) (m * pow (2.0, j / 3.0)); + *table++ = (float) (multipliers[k] * pow (2.0, j / 3.0)); *table++ = 0; } } @@ -1599,7 +1581,6 @@ struct MP3Stream bool vbrHeaderFound; private: - int encoderDelay, encoderPadding; bool headerParsed, sideParsed, dataParsed, needToSyncBitStream; bool isFreeFormat, wasFreeFormat; int sideInfoSize, dataSize; @@ -1618,7 +1599,7 @@ private: void reset() noexcept { headerParsed = sideParsed = dataParsed = isFreeFormat = wasFreeFormat = false; - encoderDelay = encoderPadding = lastFrameSize = -1; + lastFrameSize = -1; needToSyncBitStream = true; frameSize = sideInfoSize = dataSize = frameSize = bitIndex = 0; lastFrameSizeNoPadding = bufferSpaceIndex = 0; @@ -1766,8 +1747,6 @@ private: if (vbrHeaderFound) { numFrames = vbrTagData.frames; - encoderDelay = vbrTagData.encoderDelay; - encoderPadding = vbrTagData.encoderPadding; oldPos += jmax (vbrTagData.headersize, 1); } @@ -2532,7 +2511,7 @@ private: for (i = 0; i < 2; ++i) { - const newhuff* h = huffmanTables1 + granule.tableSelect[i]; + const BitsToTableMap* h = huffmanTables1 + granule.tableSelect[i]; for (int lp = l[i]; lp != 0; --lp, --mc) { @@ -2572,8 +2551,8 @@ private: if (x == 15) { max[lwin] = cb; - part2remain -= h->linbits + 1; - x += getBits ((int) h->linbits); + part2remain -= h->bits + 1; + x += getBits ((int) h->bits); *xrpnt = constants.nToThe4Over3[x] * (getOneBit() ? -v : v); } else if (x) @@ -2590,8 +2569,8 @@ private: if (y == 15) { max[lwin] = cb; - part2remain -= h->linbits + 1; - y += getBits ((int) h->linbits); + part2remain -= h->bits + 1; + y += getBits ((int) h->bits); *xrpnt = constants.nToThe4Over3[y] * (getOneBit() ? -v : v); } else if (y) @@ -2609,7 +2588,7 @@ private: for (; l3 && (part2remain > 0); --l3) { - const newhuff* h = huffmanTables2 + granule.count1TableSelect; + const BitsToTableMap* h = huffmanTables2 + granule.count1TableSelect; const int16* val = h->table; int16 a; @@ -2704,7 +2683,7 @@ private: for (i = 0; i < 3; ++i) { - const newhuff* h = huffmanTables1 + granule.tableSelect[i]; + const BitsToTableMap* h = huffmanTables1 + granule.tableSelect[i]; for (int lp = l[i]; lp != 0; --lp, --mc) { @@ -2730,8 +2709,8 @@ private: if (x == 15) { max = cb; - part2remain -= h->linbits + 1; - x += getBits ((int) h->linbits); + part2remain -= h->bits + 1; + x += getBits ((int) h->bits); *xrpnt++ = constants.nToThe4Over3[x] * (getOneBit() ? -v : v); } else if (x) @@ -2746,8 +2725,8 @@ private: if (y == 15) { max = cb; - part2remain -= h->linbits + 1; - y += getBits ((int) h->linbits); + part2remain -= h->bits + 1; + y += getBits ((int) h->bits); *xrpnt++ = constants.nToThe4Over3[y] * (getOneBit() ? -v : v); } else if (y) @@ -2763,7 +2742,7 @@ private: for (; l3 && part2remain > 0; --l3) { - const newhuff* h = huffmanTables2 + granule.count1TableSelect; + const BitsToTableMap* h = huffmanTables2 + granule.count1TableSelect; const int16* values = h->table; int16 a; diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 2cc65a6a8a..1165330cc8 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -30,10 +30,6 @@ extern AppFocusChangeCallback appFocusChangeCallback; typedef bool (*CheckEventBlockedByModalComps) (NSEvent*); extern CheckEventBlockedByModalComps isEventBlockedByModalComps; -#if JUCE_MODULE_AVAILABLE_juce_opengl && ! defined (JUCE_OSX_OPENGL_RENDERER) - //#define JUCE_OSX_OPENGL_RENDERER 1 -#endif - //============================================================================== END_JUCE_NAMESPACE @@ -218,10 +214,6 @@ public: virtual bool isOpaque(); virtual void drawRect (NSRect r); - #if JUCE_OSX_OPENGL_RENDERER - virtual void drawOpenGL(); - #endif - virtual bool canBecomeKeyWindow(); virtual void becomeKeyWindow(); virtual bool windowShouldClose(); @@ -857,48 +849,6 @@ END_JUCE_NAMESPACE @end -//============================================================================== -#if JUCE_OSX_OPENGL_RENDERER - -@interface JuceOpenGLLayer : CAOpenGLLayer -{ - NSViewComponentPeer* owner; -} - -- (JuceOpenGLLayer*) initWithPeer: (NSViewComponentPeer*) owner; -- (void) dealloc; - -- (void) drawInCGLContext: (CGLContextObj) glContext - pixelFormat: (CGLPixelFormatObj) pixelFormat - forLayerTime: (CFTimeInterval) timeInterval - displayTime: (const CVTimeStamp*) timeStamp; -@end - -@implementation JuceOpenGLLayer - -- (JuceOpenGLLayer*) initWithPeer: (NSViewComponentPeer*) owner_ -{ - [super init]; - owner = owner_; - return self; -} - -- (void) dealloc -{ - [super dealloc]; -} - -- (void) drawInCGLContext: (CGLContextObj) glContext - pixelFormat: (CGLPixelFormatObj) pixelFormat - forLayerTime: (CFTimeInterval) timeInterval - displayTime: (const CVTimeStamp*) timeStamp -{ - owner->drawOpenGL(); -} - -@end -#endif - //============================================================================== //============================================================================== BEGIN_JUCE_NAMESPACE @@ -1111,11 +1061,7 @@ void NSViewComponentPeer::setBounds (int x, int y, int w, int h, bool isNowFullS if ([view frame].size.width != r.size.width || [view frame].size.height != r.size.height) { - #if JUCE_OSX_OPENGL_RENDERER - if (usingOpenGL) - [[view layer] setNeedsDisplay: true]; - #endif - [view setNeedsDisplay: true]; + [view setNeedsDisplay: true]; } [view setFrame: r]; @@ -1126,11 +1072,6 @@ void NSViewComponentPeer::setBounds (int x, int y, int w, int h, bool isNowFullS [window setFrame: [window frameRectForContentRect: r] display: true]; - - #if JUCE_OSX_OPENGL_RENDERER - if (usingOpenGL) - [[view layer] setFrame: CGRectMake (0, 0, [view frame].size.width, [view frame].size.height)]; - #endif } } @@ -1694,21 +1635,6 @@ static void getClipRects (RectangleList& clip, NSView* view, roundToInt (rects[i].size.height)))); } -#if JUCE_OSX_OPENGL_RENDERER -void NSViewComponentPeer::drawOpenGL() -{ - if (! component->isOpaque()) - OpenGLHelpers::clear (Colours::transparentBlack); - - OpenGLRenderer context (OpenGLFrameBuffer::getCurrentFrameBufferTarget(), - component->getWidth(), component->getHeight()); - - insideDrawRect = true; - handlePaint (context); - insideDrawRect = false; -} -#endif - void NSViewComponentPeer::drawRect (NSRect r) { if (r.size.width < 1.0f || r.size.height < 1.0f) @@ -1770,44 +1696,16 @@ StringArray NSViewComponentPeer::getAvailableRenderingEngines() s.add ("CoreGraphics Renderer"); #endif - #if JUCE_OSX_OPENGL_RENDERER - s.add ("OpenGL Renderer"); - #endif - return s; } int NSViewComponentPeer::getCurrentRenderingEngine() const { - #if JUCE_OSX_OPENGL_RENDERER - if (usingOpenGL) return 2; - #endif - return usingCoreGraphics ? 1 : 0; } void NSViewComponentPeer::setCurrentRenderingEngine (int index) { - #if JUCE_OSX_OPENGL_RENDERER - if (index == 2) - { - usingCoreGraphics = false; - usingOpenGL = true; - - JuceOpenGLLayer* glLayer = [[JuceOpenGLLayer alloc] initWithPeer: this]; - [view setLayer: glLayer]; - [view setWantsLayer: YES]; - [glLayer release]; - } - else - { - usingOpenGL = false; - - [view setLayer: nil]; - [view setWantsLayer: NO]; - } - #endif - #if USE_COREGRAPHICS_RENDERING if (usingCoreGraphics != (index > 0)) { @@ -1928,14 +1826,8 @@ void NSViewComponentPeer::repaint (const Rectangle& area) } else { - #if JUCE_OSX_OPENGL_RENDERER - if (usingOpenGL) - [[view layer] setNeedsDisplayInRect: CGRectMake ((CGFloat) area.getX(), [view frame].size.height - (CGFloat) area.getBottom(), - (CGFloat) area.getWidth(), (CGFloat) area.getHeight())]; - else - #endif - [view setNeedsDisplayInRect: NSMakeRect ((CGFloat) area.getX(), [view frame].size.height - (CGFloat) area.getBottom(), - (CGFloat) area.getWidth(), (CGFloat) area.getHeight())]; + [view setNeedsDisplayInRect: NSMakeRect ((CGFloat) area.getX(), [view frame].size.height - (CGFloat) area.getBottom(), + (CGFloat) area.getWidth(), (CGFloat) area.getHeight())]; } } diff --git a/modules/juce_opengl/juce_opengl.cpp b/modules/juce_opengl/juce_opengl.cpp index 1cbe3736ea..55b0ad5b55 100644 --- a/modules/juce_opengl/juce_opengl.cpp +++ b/modules/juce_opengl/juce_opengl.cpp @@ -120,28 +120,8 @@ #include #endif -#if JUCE_WINDOWS - #define JUCE_DECLARE_GL_EXTENSION_FUNCTION(name, returnType, params) \ - typedef returnType (__stdcall *type_ ## name) params; static type_ ## name name; -#else - #define JUCE_DECLARE_GL_EXTENSION_FUNCTION(name, returnType, params) \ - typedef returnType (*type_ ## name) params; static type_ ## name name; -#endif - -#define JUCE_INSTANTIATE_GL_EXTENSION(name) \ - name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#name); - -#ifndef GL_BGRA_EXT - #define GL_BGRA_EXT 0x80e1 -#endif - -#ifndef GL_CLAMP_TO_EDGE - #define GL_CLAMP_TO_EDGE 0x812f -#endif - -#ifndef GL_DEPTH_COMPONENT16 - #define GL_DEPTH_COMPONENT16 0x81a5 -#endif +BEGIN_JUCE_NAMESPACE +#include "native/juce_OpenGLExtensions.h" //============================================================================== // START_AUTOINCLUDE opengl/*.cpp @@ -150,14 +130,15 @@ #include "opengl/juce_OpenGLGraphicsContext.cpp" #include "opengl/juce_OpenGLHelpers.cpp" #include "opengl/juce_OpenGLImage.cpp" +#include "opengl/juce_OpenGLShaderProgram.cpp" #include "opengl/juce_OpenGLTexture.cpp" // END_AUTOINCLUDE +END_JUCE_NAMESPACE using namespace juce; - -//============================================================================== BEGIN_JUCE_NAMESPACE +//============================================================================== #if JUCE_MAC || JUCE_IOS #include "../juce_core/native/juce_osx_ObjCHelpers.h" #include "../juce_core/native/juce_mac_ObjCSuffix.h" diff --git a/modules/juce_opengl/juce_opengl.h b/modules/juce_opengl/juce_opengl.h index 5be979816c..2f9387b5cd 100644 --- a/modules/juce_opengl/juce_opengl.h +++ b/modules/juce_opengl/juce_opengl.h @@ -101,6 +101,9 @@ BEGIN_JUCE_NAMESPACE #ifndef __JUCE_OPENGLRENDERINGTARGET_JUCEHEADER__ #include "opengl/juce_OpenGLRenderingTarget.h" #endif +#ifndef __JUCE_OPENGLSHADERPROGRAM_JUCEHEADER__ + #include "opengl/juce_OpenGLShaderProgram.h" +#endif #ifndef __JUCE_OPENGLTEXTURE_JUCEHEADER__ #include "opengl/juce_OpenGLTexture.h" #endif diff --git a/modules/juce_opengl/native/juce_OpenGLExtensions.h b/modules/juce_opengl/native/juce_OpenGLExtensions.h new file mode 100644 index 0000000000..6fbd342667 --- /dev/null +++ b/modules/juce_opengl/native/juce_OpenGLExtensions.h @@ -0,0 +1,187 @@ +/* + ============================================================================== + + This file is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright 2004-11 by Raw Material Software Ltd. + + ------------------------------------------------------------------------------ + + JUCE can be redistributed and/or modified under the terms of the GNU General + Public License (Version 2), as published by the Free Software Foundation. + A copy of the license is included in the JUCE distribution, or can be found + online at www.gnu.org/licenses. + + JUCE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + ------------------------------------------------------------------------------ + + To release a closed-source product which uses JUCE, commercial licenses are + available: visit www.rawmaterialsoftware.com/juce for more information. + + ============================================================================== +*/ + +namespace +{ + +#if JUCE_WINDOWS + #define JUCE_DECLARE_GL_EXTENSION_FUNCTION(name, returnType, params) \ + typedef returnType (__stdcall *type_ ## name) params; static type_ ## name name = nullptr; +#else + #define JUCE_DECLARE_GL_EXTENSION_FUNCTION(name, returnType, params) \ + typedef returnType (*type_ ## name) params; static type_ ## name name = nullptr; +#endif + +#ifndef GL_BGRA_EXT + enum { GL_BGRA_EXT = 0x80e1 }; +#endif + +#ifndef GL_CLAMP_TO_EDGE + enum { GL_CLAMP_TO_EDGE = 0x812f }; +#endif + +#ifndef GL_RGBA8 + #define GL_RGBA8 GL_RGBA +#endif + +#ifndef GL_DEPTH24_STENCIL8 + #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES +#endif + +#if JUCE_WINDOWS + +enum +{ + WGL_NUMBER_PIXEL_FORMATS_ARB = 0x2000, + WGL_DRAW_TO_WINDOW_ARB = 0x2001, + WGL_ACCELERATION_ARB = 0x2003, + WGL_SWAP_METHOD_ARB = 0x2007, + WGL_SUPPORT_OPENGL_ARB = 0x2010, + WGL_PIXEL_TYPE_ARB = 0x2013, + WGL_DOUBLE_BUFFER_ARB = 0x2011, + WGL_COLOR_BITS_ARB = 0x2014, + WGL_RED_BITS_ARB = 0x2015, + WGL_GREEN_BITS_ARB = 0x2017, + WGL_BLUE_BITS_ARB = 0x2019, + WGL_ALPHA_BITS_ARB = 0x201B, + WGL_DEPTH_BITS_ARB = 0x2022, + WGL_STENCIL_BITS_ARB = 0x2023, + WGL_FULL_ACCELERATION_ARB = 0x2027, + WGL_ACCUM_RED_BITS_ARB = 0x201E, + WGL_ACCUM_GREEN_BITS_ARB = 0x201F, + WGL_ACCUM_BLUE_BITS_ARB = 0x2020, + WGL_ACCUM_ALPHA_BITS_ARB = 0x2021, + WGL_STEREO_ARB = 0x2012, + WGL_SAMPLE_BUFFERS_ARB = 0x2041, + WGL_SAMPLES_ARB = 0x2042, + WGL_TYPE_RGBA_ARB = 0x202B, + + GL_OPERAND0_RGB = 0x8590, + GL_OPERAND1_RGB = 0x8591, + GL_OPERAND0_ALPHA = 0x8598, + GL_OPERAND1_ALPHA = 0x8599, + GL_SRC0_RGB = 0x8580, + GL_SRC1_RGB = 0x8581, + GL_SRC0_ALPHA = 0x8588, + GL_SRC1_ALPHA = 0x8589, + GL_TEXTURE0 = 0x84C0, + GL_TEXTURE1 = 0x84C1, + GL_TEXTURE2 = 0x84C2, + GL_COMBINE = 0x8570, + GL_COMBINE_RGB = 0x8571, + GL_COMBINE_ALPHA = 0x8572, + GL_PREVIOUS = 0x8578, + GL_COMPILE_STATUS = 0x8B81, + GL_LINK_STATUS = 0x8B82, + GL_SHADING_LANGUAGE_VERSION = 0x8B8C, + GL_FRAGMENT_SHADER = 0x8B30, + GL_FRAMEBUFFER = 0x8D40, + GL_RENDERBUFFER = 0x8D41, + GL_FRAMEBUFFER_BINDING = 0x8CA6, + GL_COLOR_ATTACHMENT0 = 0x8CE0, + GL_DEPTH_ATTACHMENT = 0x8D00, + GL_STENCIL_ATTACHMENT = 0x8D20, + GL_FRAMEBUFFER_COMPLETE = 0x8CD5, + GL_DEPTH24_STENCIL8 = 0x88F0, + GL_RENDERBUFFER_DEPTH_SIZE = 0x8D54 +}; + +typedef char GLchar; + +#define WGL_FUNCTION_LIST(USE_FUNCTION) \ + USE_FUNCTION (wglChoosePixelFormatARB, BOOL, (HDC, const int*, const FLOAT*, UINT, int*, UINT*))\ + USE_FUNCTION (wglSwapIntervalEXT, BOOL, (int))\ + USE_FUNCTION (wglGetSwapIntervalEXT, int, ())\ + +WGL_FUNCTION_LIST (JUCE_DECLARE_GL_EXTENSION_FUNCTION) +#endif + +#if JUCE_WINDOWS || JUCE_LINUX + +#define GL_EXTENSIONS_LIST(USE_FUNCTION) \ + USE_FUNCTION (glActiveTexture, void, (GLenum))\ + USE_FUNCTION (glClientActiveTexture, void, (GLenum))\ + USE_FUNCTION (glCreateProgram, GLuint, ())\ + USE_FUNCTION (glDeleteProgram, void, (GLuint))\ + USE_FUNCTION (glCreateShader, GLuint, (GLenum))\ + USE_FUNCTION (glDeleteShader, void, (GLuint))\ + USE_FUNCTION (glShaderSource, void, (GLuint, GLsizei, const GLchar**, const GLint*))\ + USE_FUNCTION (glCompileShader, void, (GLuint))\ + USE_FUNCTION (glAttachShader, void, (GLuint, GLuint))\ + USE_FUNCTION (glLinkProgram, void, (GLuint))\ + USE_FUNCTION (glUseProgram, void, (GLuint))\ + USE_FUNCTION (glGetShaderiv, void, (GLuint, GLenum, GLint*))\ + USE_FUNCTION (glGetShaderInfoLog, void, (GLuint, GLsizei, GLsizei*, GLchar*))\ + USE_FUNCTION (glGetProgramiv, void, (GLuint, GLenum, GLint*))\ + USE_FUNCTION (glGetUniformLocation, GLint, (GLuint, const GLchar*))\ + USE_FUNCTION (glUniform1f, void, (GLint, GLfloat))\ + USE_FUNCTION (glUniform1i, void, (GLint, GLint))\ + USE_FUNCTION (glUniform2f, void, (GLint, GLfloat, GLfloat))\ + USE_FUNCTION (glUniform3f, void, (GLint, GLfloat, GLfloat, GLfloat))\ + USE_FUNCTION (glUniform4f, void, (GLint, GLfloat, GLfloat, GLfloat, GLfloat))\ + USE_FUNCTION (glUniform4i, void, (GLint, GLint, GLint, GLint, GLint))\ + USE_FUNCTION (glUniform1fv, void, (GLint, GLsizei, const GLfloat*))\ + USE_FUNCTION (glIsRenderbuffer, GLboolean, (GLuint))\ + USE_FUNCTION (glBindRenderbuffer, void, (GLenum, GLuint))\ + USE_FUNCTION (glDeleteRenderbuffers, void, (GLsizei, const GLuint*))\ + USE_FUNCTION (glGenRenderbuffers, void, (GLsizei, GLuint*))\ + USE_FUNCTION (glRenderbufferStorage, void, (GLenum, GLenum, GLsizei, GLsizei))\ + USE_FUNCTION (glGetRenderbufferParameteriv, void, (GLenum, GLenum, GLint*))\ + USE_FUNCTION (glIsFramebuffer, GLboolean, (GLuint))\ + USE_FUNCTION (glBindFramebuffer, void, (GLenum, GLuint))\ + USE_FUNCTION (glDeleteFramebuffers, void, (GLsizei, const GLuint*))\ + USE_FUNCTION (glGenFramebuffers, void, (GLsizei, GLuint*))\ + USE_FUNCTION (glCheckFramebufferStatus, GLenum, (GLenum))\ + USE_FUNCTION (glFramebufferTexture1D, void, (GLenum, GLenum, GLenum, GLuint, GLint))\ + USE_FUNCTION (glFramebufferTexture2D, void, (GLenum, GLenum, GLenum, GLuint, GLint))\ + USE_FUNCTION (glFramebufferTexture3D, void, (GLenum, GLenum, GLenum, GLuint, GLint, GLint))\ + USE_FUNCTION (glFramebufferRenderbuffer, void, (GLenum, GLenum, GLenum, GLuint))\ + USE_FUNCTION (glGetFramebufferAttachmentParameteriv, void, (GLenum, GLenum, GLenum, GLint*))\ + +GL_EXTENSIONS_LIST (JUCE_DECLARE_GL_EXTENSION_FUNCTION) + +void initialiseGLExtensions() +{ + if (glActiveTexture == nullptr) + { + #define FIND_FUNCTION(name, returnType, params) name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#name); + + #if JUCE_WINDOWS + WGL_FUNCTION_LIST (FIND_FUNCTION) + #endif + GL_EXTENSIONS_LIST (FIND_FUNCTION) + + #undef FIND_FUNCTION + } +} + +#undef GL_EXTENSIONS_LIST +#undef WGL_FUNCTION_LIST + +#else +void initialiseGLExtensions() {} +#endif + +} diff --git a/modules/juce_opengl/native/juce_linux_OpenGLComponent.cpp b/modules/juce_opengl/native/juce_linux_OpenGLComponent.cpp index 7b086b6f80..8be9ed127a 100644 --- a/modules/juce_opengl/native/juce_linux_OpenGLComponent.cpp +++ b/modules/juce_opengl/native/juce_linux_OpenGLComponent.cpp @@ -37,6 +37,8 @@ public: embeddedWindow (0), swapInterval (0) { + initialiseGLExtensions(); + jassert (component != nullptr); ComponentPeer* const peer = component->getTopLevelComponent()->getPeer(); if (peer == nullptr) diff --git a/modules/juce_opengl/native/juce_mac_OpenGLComponent.mm b/modules/juce_opengl/native/juce_mac_OpenGLComponent.mm index dc5e084222..bfda650257 100644 --- a/modules/juce_opengl/native/juce_mac_OpenGLComponent.mm +++ b/modules/juce_opengl/native/juce_mac_OpenGLComponent.mm @@ -123,6 +123,8 @@ public: NSOpenGLContext* sharedContext) : renderContext (nil) { + initialiseGLExtensions(); + NSOpenGLPixelFormatAttribute attribs[] = { NSOpenGLPFADoubleBuffer, diff --git a/modules/juce_opengl/native/juce_win32_OpenGLComponent.cpp b/modules/juce_opengl/native/juce_win32_OpenGLComponent.cpp index 35d568692c..43440d58a6 100644 --- a/modules/juce_opengl/native/juce_win32_OpenGLComponent.cpp +++ b/modules/juce_opengl/native/juce_win32_OpenGLComponent.cpp @@ -23,51 +23,6 @@ ============================================================================== */ -enum -{ - WGL_NUMBER_PIXEL_FORMATS_ARB = 0x2000, - WGL_DRAW_TO_WINDOW_ARB = 0x2001, - WGL_ACCELERATION_ARB = 0x2003, - WGL_SWAP_METHOD_ARB = 0x2007, - WGL_SUPPORT_OPENGL_ARB = 0x2010, - WGL_PIXEL_TYPE_ARB = 0x2013, - WGL_DOUBLE_BUFFER_ARB = 0x2011, - WGL_COLOR_BITS_ARB = 0x2014, - WGL_RED_BITS_ARB = 0x2015, - WGL_GREEN_BITS_ARB = 0x2017, - WGL_BLUE_BITS_ARB = 0x2019, - WGL_ALPHA_BITS_ARB = 0x201B, - WGL_DEPTH_BITS_ARB = 0x2022, - WGL_STENCIL_BITS_ARB = 0x2023, - WGL_FULL_ACCELERATION_ARB = 0x2027, - WGL_ACCUM_RED_BITS_ARB = 0x201E, - WGL_ACCUM_GREEN_BITS_ARB = 0x201F, - WGL_ACCUM_BLUE_BITS_ARB = 0x2020, - WGL_ACCUM_ALPHA_BITS_ARB = 0x2021, - WGL_STEREO_ARB = 0x2012, - WGL_SAMPLE_BUFFERS_ARB = 0x2041, - WGL_SAMPLES_ARB = 0x2042, - WGL_TYPE_RGBA_ARB = 0x202B -}; - -typedef BOOL (WINAPI* PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC, const int*, const FLOAT*, UINT, int*, UINT*); -typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int); -typedef int (WINAPI* PFNWGLGETSWAPINTERVALEXTPROC)(); - -static PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = 0; -static PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = 0; -static PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = 0; - -static void initialiseGLExtensions() -{ - if (wglChoosePixelFormatARB == 0) - { - wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC) OpenGLHelpers::getExtensionFunction ("wglChoosePixelFormatARB"); - wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) OpenGLHelpers::getExtensionFunction ("wglSwapIntervalEXT"); - wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC) OpenGLHelpers::getExtensionFunction ("wglGetSwapIntervalEXT"); - } -} - extern ComponentPeer* createNonRepaintingEmbeddedWindowsPeer (Component* component, void* parent); //============================================================================== @@ -81,6 +36,7 @@ public: component (component_), dc (0) { + initialiseGLExtensions(); jassert (component != nullptr); createNativeWindow(); diff --git a/modules/juce_opengl/opengl/juce_OpenGLComponent.cpp b/modules/juce_opengl/opengl/juce_OpenGLComponent.cpp index 0ca3074da5..51ab66b793 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLComponent.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLComponent.cpp @@ -23,9 +23,6 @@ ============================================================================== */ -BEGIN_JUCE_NAMESPACE - - //============================================================================== OpenGLPixelFormat::OpenGLPixelFormat (const int bitsPerRGBComponent, const int alphaBits_, @@ -556,5 +553,3 @@ unsigned int OpenGLComponent::getFrameBufferID() const { return context != nullptr ? context->getFrameBufferID() : 0; } - -END_JUCE_NAMESPACE diff --git a/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp b/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp index ccd3e088bf..978019f31c 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLFrameBuffer.cpp @@ -23,102 +23,6 @@ ============================================================================== */ -BEGIN_JUCE_NAMESPACE - -namespace -{ - #if JUCE_WINDOWS - enum - { - GL_FRAMEBUFFER_EXT = 0x8D40, - GL_RENDERBUFFER_EXT = 0x8D41, - GL_FRAMEBUFFER_BINDING_EXT = 0x8CA6, - GL_COLOR_ATTACHMENT0_EXT = 0x8CE0, - GL_DEPTH_ATTACHMENT_EXT = 0x8D00, - GL_STENCIL_ATTACHMENT_EXT = 0x8D20, - GL_FRAMEBUFFER_COMPLETE_EXT = 0x8CD5, - GL_DEPTH24_STENCIL8_EXT = 0x88F0, - GL_RENDERBUFFER_DEPTH_SIZE_EXT = 0x8D54 - }; - #endif - - #if JUCE_WINDOWS || JUCE_LINUX - - #define FRAMEBUFFER_FUNCTION_LIST(USE_FUNCTION) \ - USE_FUNCTION (glIsRenderbufferEXT, GLboolean, (GLuint renderbuffer))\ - USE_FUNCTION (glBindRenderbufferEXT, void, (GLenum target, GLuint renderbuffer))\ - USE_FUNCTION (glDeleteRenderbuffersEXT, void, (GLsizei n, const GLuint *renderbuffers))\ - USE_FUNCTION (glGenRenderbuffersEXT, void, (GLsizei n, GLuint *renderbuffers))\ - USE_FUNCTION (glRenderbufferStorageEXT, void, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height))\ - USE_FUNCTION (glGetRenderbufferParameterivEXT, void, (GLenum target, GLenum pname, GLint* params))\ - USE_FUNCTION (glIsFramebufferEXT, GLboolean, (GLuint framebuffer))\ - USE_FUNCTION (glBindFramebufferEXT, void, (GLenum target, GLuint framebuffer))\ - USE_FUNCTION (glDeleteFramebuffersEXT, void, (GLsizei n, const GLuint *framebuffers))\ - USE_FUNCTION (glGenFramebuffersEXT, void, (GLsizei n, GLuint *framebuffers))\ - USE_FUNCTION (glCheckFramebufferStatusEXT, GLenum, (GLenum target))\ - USE_FUNCTION (glFramebufferTexture1DEXT, void, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level))\ - USE_FUNCTION (glFramebufferTexture2DEXT, void, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level))\ - USE_FUNCTION (glFramebufferTexture3DEXT, void, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset))\ - USE_FUNCTION (glFramebufferRenderbufferEXT, void, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer))\ - USE_FUNCTION (glGetFramebufferAttachmentParameterivEXT, void, (GLenum target, GLenum attachment, GLenum pname, GLint *params))\ - USE_FUNCTION (glGenerateMipmapEXT, void, (GLenum target))\ - - FRAMEBUFFER_FUNCTION_LIST (JUCE_DECLARE_GL_EXTENSION_FUNCTION) - - static bool framebufferFunctionsInitialised = false; - - void initialiseFrameBufferFunctions() - { - if (! framebufferFunctionsInitialised) - { - framebufferFunctionsInitialised = true; - - #define FIND_FUNCTION(name, returnType, params) name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#name); - FRAMEBUFFER_FUNCTION_LIST (FIND_FUNCTION) - #undef FIND_FUNCTION - } - } - - #undef FRAMEBUFFER_FUNCTION_LIST - - //============================================================================== - #elif JUCE_OPENGL_ES - - #define glIsRenderbufferEXT glIsRenderbufferOES - #define glBindRenderbufferEXT glBindRenderbufferOES - #define glDeleteRenderbuffersEXT glDeleteRenderbuffersOES - #define glGenRenderbuffersEXT glGenRenderbuffersOES - #define glRenderbufferStorageEXT glRenderbufferStorageOES - #define glGetRenderbufferParameterivEXT glGetRenderbufferParameterivOES - #define glIsFramebufferEXT glIsFramebufferOES - #define glBindFramebufferEXT glBindFramebufferOES - #define glDeleteFramebuffersEXT glDeleteFramebuffersOES - #define glGenFramebuffersEXT glGenFramebuffersOES - #define glCheckFramebufferStatusEXT glCheckFramebufferStatusOES - #define glFramebufferTexture1DEXT glFramebufferTexture1DOES - #define glFramebufferTexture2DEXT glFramebufferTexture2DOES - #define glFramebufferTexture3DEXT glFramebufferTexture3DOES - #define glFramebufferRenderbufferEXT glFramebufferRenderbufferOES - #define glGetFramebufferAttachmentParameterivEXT glGetFramebufferAttachmentParameterivOES - #define glGenerateMipmapEXT glGenerateMipmapOES - - #define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER_OES - #define GL_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_OES - #define GL_RGBA8 GL_RGBA - #define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0_OES - #define GL_RENDERBUFFER_EXT GL_RENDERBUFFER_OES - #define GL_DEPTH24_STENCIL8_EXT GL_DEPTH24_STENCIL8_OES - #define GL_RENDERBUFFER_DEPTH_SIZE_EXT GL_RENDERBUFFER_DEPTH_SIZE_OES - #define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT_OES - #define GL_STENCIL_ATTACHMENT_EXT GL_STENCIL_ATTACHMENT_OES - #define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE_OES - #define GL_FRAMEBUFFER_UNSUPPORTED_EXT GL_FRAMEBUFFER_UNSUPPORTED_OES - #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES - - #endif -} - -//============================================================================== class OpenGLFrameBuffer::Pimpl { public: @@ -138,14 +42,12 @@ public: jassert (OpenGLHelpers::isContextActive()); #if JUCE_WINDOWS || JUCE_LINUX - initialiseFrameBufferFunctions(); - - if (glGenFramebuffersEXT == nullptr) + if (glGenFramebuffers == nullptr) return; #endif - glGenFramebuffersEXT (1, &frameBufferHandle); - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, frameBufferHandle); + glGenFramebuffers (1, &frameBufferHandle); + glBindFramebuffer (GL_FRAMEBUFFER, frameBufferHandle); glGenTextures (1, &textureID); glBindTexture (GL_TEXTURE_2D, textureID); @@ -157,16 +59,16 @@ public: glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, textureID, 0); + glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureID, 0); if (wantsDepthBuffer || wantsStencilBuffer) { - glGenRenderbuffersEXT (1, &depthOrStencilBuffer); - glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, depthOrStencilBuffer); - jassert (glIsRenderbufferEXT (depthOrStencilBuffer)); + glGenRenderbuffers (1, &depthOrStencilBuffer); + glBindRenderbuffer (GL_RENDERBUFFER, depthOrStencilBuffer); + jassert (glIsRenderbuffer (depthOrStencilBuffer)); - glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, - (wantsDepthBuffer && wantsStencilBuffer) ? GL_DEPTH24_STENCIL8_EXT + glRenderbufferStorage (GL_RENDERBUFFER, + (wantsDepthBuffer && wantsStencilBuffer) ? GL_DEPTH24_STENCIL8 #if JUCE_OPENGL_ES : GL_DEPTH_COMPONENT16, #else @@ -175,17 +77,17 @@ public: width, height); GLint params = 0; - glGetRenderbufferParameterivEXT (GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_DEPTH_SIZE_EXT, ¶ms); - glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthOrStencilBuffer); + glGetRenderbufferParameteriv (GL_RENDERBUFFER, GL_RENDERBUFFER_DEPTH_SIZE, ¶ms); + glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthOrStencilBuffer); if (wantsStencilBuffer) - glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, depthOrStencilBuffer); + glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, depthOrStencilBuffer); hasDepthBuffer = wantsDepthBuffer; hasStencilBuffer = wantsStencilBuffer; } - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); + glBindFramebuffer (GL_FRAMEBUFFER, 0); } ~Pimpl() @@ -194,14 +96,14 @@ public: glDeleteTextures (1, &textureID); if (depthOrStencilBuffer != 0) - glDeleteRenderbuffersEXT (1, &depthOrStencilBuffer); + glDeleteRenderbuffers (1, &depthOrStencilBuffer); if (frameBufferHandle != 0) - glDeleteFramebuffersEXT (1, &frameBufferHandle); + glDeleteFramebuffers (1, &frameBufferHandle); } - void bind() { glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, frameBufferHandle); } - void unbind() { glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); } + void bind() { glBindFramebuffer (GL_FRAMEBUFFER, frameBufferHandle); } + void unbind() { glBindFramebuffer (GL_FRAMEBUFFER, 0); } const int width, height; GLuint textureID, frameBufferHandle, depthOrStencilBuffer; @@ -210,10 +112,10 @@ public: private: static bool checkStatus() noexcept { - const GLenum status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); + const GLenum status = glCheckFramebufferStatus (GL_FRAMEBUFFER); return status == GL_NO_ERROR - || status == GL_FRAMEBUFFER_COMPLETE_EXT; + || status == GL_FRAMEBUFFER_COMPLETE; } JUCE_DECLARE_NON_COPYABLE (Pimpl); @@ -348,13 +250,13 @@ bool OpenGLFrameBuffer::makeCurrentRenderingTarget() void OpenGLFrameBuffer::setCurrentFrameBufferTarget (GLuint frameBufferID) { - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, frameBufferID); + glBindFramebuffer (GL_FRAMEBUFFER, frameBufferID); } GLuint OpenGLFrameBuffer::getCurrentFrameBufferTarget() { GLint fb; - glGetIntegerv (GL_FRAMEBUFFER_BINDING_EXT, &fb); + glGetIntegerv (GL_FRAMEBUFFER_BINDING, &fb); return (GLuint) fb; } @@ -388,7 +290,7 @@ bool OpenGLFrameBuffer::readPixels (PixelARGB* target, const Rectangle& are glPixelStorei (GL_PACK_ALIGNMENT, 4); glReadPixels (area.getX(), area.getY(), area.getWidth(), area.getHeight(), GL_BGRA_EXT, GL_UNSIGNED_BYTE, target); - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); + glBindFramebuffer (GL_FRAMEBUFFER, 0); glPixelStorei (GL_PACK_ALIGNMENT, 0); return true; } @@ -433,7 +335,7 @@ bool OpenGLFrameBuffer::writePixels (const PixelARGB* data, const Rectangle OpenGLHelpers::drawTriangleStrip (vertices, textureCoords, 4, tex.getTextureID()); #endif - glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0); + glBindFramebuffer (GL_FRAMEBUFFER, 0); return true; } @@ -492,6 +394,3 @@ void OpenGLFrameBuffer::drawAt (float x1, float y1) const glBindTexture (GL_TEXTURE_2D, 0); } } - - -END_JUCE_NAMESPACE diff --git a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp index 3bef25d48e..0b52970d97 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.cpp @@ -23,94 +23,10 @@ ============================================================================== */ -BEGIN_JUCE_NAMESPACE - #if JUCE_MAC || JUCE_WINDOWS || JUCE_LINUX // #define JUCE_USE_OPENGL_SHADERS 1 #endif -namespace -{ - #if JUCE_WINDOWS - enum - { - GL_OPERAND0_RGB = 0x8590, - GL_OPERAND1_RGB = 0x8591, - GL_OPERAND0_ALPHA = 0x8598, - GL_OPERAND1_ALPHA = 0x8599, - GL_SRC0_RGB = 0x8580, - GL_SRC1_RGB = 0x8581, - GL_SRC0_ALPHA = 0x8588, - GL_SRC1_ALPHA = 0x8589, - GL_TEXTURE0 = 0x84C0, - GL_TEXTURE1 = 0x84C1, - GL_TEXTURE2 = 0x84C2, - GL_COMBINE = 0x8570, - GL_COMBINE_RGB = 0x8571, - GL_COMBINE_ALPHA = 0x8572, - GL_PREVIOUS = 0x8578, - GL_COMPILE_STATUS = 0x8B81, - GL_LINK_STATUS = 0x8B82, - GL_SHADING_LANGUAGE_VERSION = 0x8B8C, - GL_FRAGMENT_SHADER = 0x8B30 - }; - - typedef char GLchar; - #endif - - #if JUCE_WINDOWS || JUCE_LINUX - - #if JUCE_USE_OPENGL_SHADERS - #define WINDOWS_GL_FUNCTION_LIST(USE_FUNCTION) \ - USE_FUNCTION (glActiveTexture, void, (GLenum))\ - USE_FUNCTION (glClientActiveTexture, void, (GLenum))\ - USE_FUNCTION (glCreateProgram, GLuint, ())\ - USE_FUNCTION (glDeleteProgram, void, (GLuint))\ - USE_FUNCTION (glCreateShader, GLuint, (GLenum))\ - USE_FUNCTION (glDeleteShader, void, (GLuint))\ - USE_FUNCTION (glShaderSource, void, (GLuint, GLsizei, const GLchar**, const GLint*))\ - USE_FUNCTION (glCompileShader, void, (GLuint))\ - USE_FUNCTION (glAttachShader, void, (GLuint, GLuint))\ - USE_FUNCTION (glLinkProgram, void, (GLuint))\ - USE_FUNCTION (glUseProgram, void, (GLuint))\ - USE_FUNCTION (glGetShaderiv, void, (GLuint, GLenum, GLint*))\ - USE_FUNCTION (glGetShaderInfoLog, void, (GLuint, GLsizei, GLsizei*, GLchar*))\ - USE_FUNCTION (glGetProgramiv, void, (GLuint, GLenum, GLint*))\ - USE_FUNCTION (glGetUniformLocation, GLint, (GLuint, const GLchar*))\ - USE_FUNCTION (glUniform1f, void, (GLint, GLfloat))\ - USE_FUNCTION (glUniform1i, void, (GLint, GLint))\ - USE_FUNCTION (glUniform2f, void, (GLint, GLfloat, GLfloat))\ - USE_FUNCTION (glUniform3f, void, (GLint, GLfloat, GLfloat, GLfloat))\ - USE_FUNCTION (glUniform4f, void, (GLint, GLfloat, GLfloat, GLfloat, GLfloat))\ - USE_FUNCTION (glUniform4i, void, (GLint, GLint, GLint, GLint, GLint))\ - USE_FUNCTION (glUniformMatrix2x3fv, void, (GLint, GLsizei, GLboolean, const GLfloat*))\ - - #else - #define WINDOWS_GL_FUNCTION_LIST(USE_FUNCTION) \ - USE_FUNCTION (glActiveTexture, void, (GLenum))\ - USE_FUNCTION (glClientActiveTexture, void, (GLenum)) - #endif - - WINDOWS_GL_FUNCTION_LIST (JUCE_DECLARE_GL_EXTENSION_FUNCTION) - - static bool windowsFunctionsInitialised = false; - - void initialiseWindowsExtensions() - { - windowsFunctionsInitialised = true; - - #define FIND_FUNCTION(name, returnType, params) name = (type_ ## name) OpenGLHelpers::getExtensionFunction (#name); - WINDOWS_GL_FUNCTION_LIST (FIND_FUNCTION) - #undef FIND_FUNCTION - } - - #undef WINDOWS_GL_FUNCTION_LIST - - #else - void initialiseWindowsExtensions() {} - #endif -} - //============================================================================== struct OpenGLTarget { @@ -288,94 +204,14 @@ namespace //============================================================================== #if JUCE_USE_OPENGL_SHADERS -class OpenGLShaderProgram -{ -public: - OpenGLShaderProgram() noexcept - : program (glCreateProgram()) - { - } - - ~OpenGLShaderProgram() noexcept - { - glDeleteProgram (program); - } - - void addShader (const GLchar* const code, GLenum type) - { - GLuint shaderID = glCreateShader (type); - glShaderSource (shaderID, 1, (const GLchar**) &code, nullptr); - glCompileShader (shaderID); - - #if JUCE_DEBUG - GLint status = 0; - glGetShaderiv (shaderID, GL_COMPILE_STATUS, &status); - - if (status == GL_FALSE) - { - GLchar infoLog [16384]; - GLsizei infologLength = 0; - glGetShaderInfoLog (shaderID, sizeof (infoLog), &infologLength, infoLog); - DBG (String (infoLog, infologLength)); - jassertfalse; - } - #endif - - glAttachShader (program, shaderID); - glDeleteShader (shaderID); - } - - void link() noexcept - { - glLinkProgram (program); - - #if JUCE_DEBUG - GLint status = 0; - glGetProgramiv (program, GL_LINK_STATUS, &status); - jassert (status != GL_FALSE); - #endif - } - - struct Uniform - { - Uniform (const OpenGLShaderProgram& program, const GLchar* name) - : uniformID (glGetUniformLocation (program.program, name)) - { - jassert (uniformID >= 0); - } - - void set (GLfloat n1) const noexcept { glUniform1f (uniformID, n1); } - void set (GLint n1) const noexcept { glUniform1i (uniformID, n1); } - void set (GLfloat n1, GLfloat n2) const noexcept { glUniform2f (uniformID, n1, n2); } - void set (GLfloat n1, GLfloat n2, GLfloat n3) const noexcept { glUniform3f (uniformID, n1, n2, n3); } - void set (GLfloat n1, GLfloat n2, GLfloat n3, float n4) const noexcept { glUniform4f (uniformID, n1, n2, n3, n4); } - void set (GLint n1, GLint n2, GLint n3, GLint n4) const noexcept { glUniform4i (uniformID, n1, n2, n3, n4); } - - void set (const AffineTransform& t) const noexcept - { - const GLfloat f[] = { t.mat00, t.mat01, t.mat02, t.mat10, t.mat11, t.mat12 }; - glUniformMatrix2x3fv (uniformID, 1, false, f); - } - - GLint uniformID; - }; - - GLuint program; - -private: - JUCE_DECLARE_NON_COPYABLE (OpenGLShaderProgram); -}; - struct ShaderPrograms { ShaderPrograms() + : areShadersSupported (OpenGLShaderProgram::getLanguageVersion() >= 1.199) { - String v ((const char*) glGetString (GL_SHADING_LANGUAGE_VERSION)); - v = v.upToFirstOccurrenceOf (" ", false, false); - areShadersSupported = (v.getDoubleValue() >= 1.199); } - bool areShadersSupported; + const bool areShadersSupported; struct ShaderBase { @@ -392,7 +228,7 @@ struct ShaderPrograms { MaskedShaderParams (const OpenGLShaderProgram& program) : maskTexture (program, "maskTexture"), - maskBounds (program, "maskBounds") + maskBounds (program, "maskBounds") {} OpenGLShaderProgram::Uniform maskTexture, maskBounds; @@ -407,9 +243,12 @@ struct ShaderPrograms void setMatrix (const Point& p1, const Point& p2, const Point& p3) { - matrix.set (AffineTransform::fromTargetPoints (p1.x, p1.y, 0.0f, 0.0f, - p2.x, p2.y, 1.0f, 0.0f, - p3.x, p3.y, 0.0f, 1.0f)); + const AffineTransform t (AffineTransform::fromTargetPoints (p1.x, p1.y, 0.0f, 0.0f, + p2.x, p2.y, 1.0f, 0.0f, + p3.x, p3.y, 0.0f, 1.0f)); +// const GLfloat m[] = { t.mat00, t.mat01, t.mat02, t.mat10, t.mat11, t.mat12 }; + const GLfloat m[] = { t.mat00, t.mat01, t.mat02, t.mat10, t.mat11, t.mat12 }; + matrix.set (m, 6); } OpenGLShaderProgram::Uniform gradientTexture, matrix; @@ -451,13 +290,13 @@ struct ShaderPrograms RadialGradientProgram() : ShaderBase ("#version 120\n" "uniform sampler2D gradientTexture;" - "uniform mat2x3 matrix;" + "uniform float matrix[6];" "const float textureY = 0.5;" "" "void main()" "{" - " float dist = length (vec2 (matrix[0][0] * gl_FragCoord.x + matrix[0][1] * gl_FragCoord.y + matrix[0][2]," - " matrix[1][0] * gl_FragCoord.x + matrix[1][1] * gl_FragCoord.y + matrix[1][2]));" + " float dist = length (vec2 (matrix[0] * gl_FragCoord.x + matrix[1] * gl_FragCoord.y + matrix[2]," + " matrix[3] * gl_FragCoord.x + matrix[4] * gl_FragCoord.y + matrix[5]));" " gl_FragColor = gl_Color.w * texture2D (gradientTexture, vec2 (dist, textureY));" "}"), gradientParams (program) @@ -472,15 +311,15 @@ struct ShaderPrograms RadialGradientMaskedProgram() : ShaderBase ("#version 120\n" "uniform sampler2D gradientTexture;" - "uniform mat2x3 matrix;" + "uniform float matrix[6];" "uniform sampler2D maskTexture;" "uniform ivec4 maskBounds;" "const float textureY = 0.5;" "" "void main()" "{" - " float dist = length (vec2 (matrix[0][0] * gl_FragCoord.x + matrix[0][1] * gl_FragCoord.y + matrix[0][2]," - " matrix[1][0] * gl_FragCoord.x + matrix[1][1] * gl_FragCoord.y + matrix[1][2]));" + " float dist = length (vec2 (matrix[0] * gl_FragCoord.x + matrix[1] * gl_FragCoord.y + matrix[2]," + " matrix[3] * gl_FragCoord.x + matrix[4] * gl_FragCoord.y + matrix[5]));" " vec4 result = gl_Color.w * texture2D (gradientTexture, vec2 (dist, textureY));" "" " vec2 maskPos;" @@ -631,10 +470,11 @@ public: , activeShader (nullptr) #endif { + initialiseGLExtensions(); + // This object can only be created and used when the current thread has an active OpenGL context. jassert (OpenGLHelpers::isContextActive()); - initialiseWindowsExtensions(); target.makeActiveFor2D(); glDisableClientState (GL_COLOR_ARRAY); glDisableClientState (GL_NORMAL_ARRAY); @@ -1303,7 +1143,7 @@ public: { flushQuads(); activeShader = newShader; - glUseProgram (newShader != nullptr ? newShader->program : 0); + glUseProgram (newShader != nullptr ? newShader->programID : 0); } } #endif @@ -2490,5 +2330,3 @@ void OpenGLRenderer::drawGlyph (int glyphNumber, const AffineTransform& t) void OpenGLRenderer::drawLine (const Line & line) { stack->drawLine (line); } void OpenGLRenderer::setFont (const Font& newFont) { stack->font = newFont; } Font OpenGLRenderer::getFont() { return stack->font; } - -END_JUCE_NAMESPACE diff --git a/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp b/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp index cc4c887eef..2252b52547 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLHelpers.cpp @@ -23,9 +23,6 @@ ============================================================================== */ -BEGIN_JUCE_NAMESPACE - -//============================================================================== void OpenGLHelpers::resetErrorState() { while (glGetError() != GL_NO_ERROR) {} @@ -315,6 +312,3 @@ void OpenGLRenderingTarget::prepareFor2D() OpenGLHelpers::prepareFor2D (getRenderingTargetWidth(), getRenderingTargetHeight()); } - - -END_JUCE_NAMESPACE diff --git a/modules/juce_opengl/opengl/juce_OpenGLImage.cpp b/modules/juce_opengl/opengl/juce_OpenGLImage.cpp index b49e18a4d2..439ddea3ee 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLImage.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLImage.cpp @@ -23,10 +23,7 @@ ============================================================================== */ -BEGIN_JUCE_NAMESPACE - -//============================================================================== class OpenGLFrameBufferImage : public ImagePixelData { public: @@ -193,5 +190,3 @@ OpenGLFrameBuffer* OpenGLImageType::getFrameBufferFrom (const Image& image) return glImage != nullptr ? &(glImage->frameBuffer) : nullptr; } - -END_JUCE_NAMESPACE diff --git a/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp b/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp new file mode 100644 index 0000000000..3b64d7e696 --- /dev/null +++ b/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.cpp @@ -0,0 +1,92 @@ +/* + ============================================================================== + + This file is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright 2004-11 by Raw Material Software Ltd. + + ------------------------------------------------------------------------------ + + JUCE can be redistributed and/or modified under the terms of the GNU General + Public License (Version 2), as published by the Free Software Foundation. + A copy of the license is included in the JUCE distribution, or can be found + online at www.gnu.org/licenses. + + JUCE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + ------------------------------------------------------------------------------ + + To release a closed-source product which uses JUCE, commercial licenses are + available: visit www.rawmaterialsoftware.com/juce for more information. + + ============================================================================== +*/ + +OpenGLShaderProgram::OpenGLShaderProgram() noexcept +{ + // This object can only be created and used when the current thread has an active OpenGL context. + jassert (OpenGLHelpers::isContextActive()); + + programID = glCreateProgram(); +} + +OpenGLShaderProgram::~OpenGLShaderProgram() noexcept +{ + glDeleteProgram (programID); +} + +double OpenGLShaderProgram::getLanguageVersion() +{ + return String ((const char*) glGetString (GL_SHADING_LANGUAGE_VERSION)) + .upToFirstOccurrenceOf (" ", false, false).getDoubleValue(); +} + +void OpenGLShaderProgram::addShader (const char* const code, GLenum type) +{ + GLuint shaderID = glCreateShader (type); + glShaderSource (shaderID, 1, (const GLchar**) &code, nullptr); + glCompileShader (shaderID); + + #if JUCE_DEBUG + GLint status = 0; + glGetShaderiv (shaderID, GL_COMPILE_STATUS, &status); + + if (status == GL_FALSE) + { + GLchar infoLog [16384]; + GLsizei infologLength = 0; + glGetShaderInfoLog (shaderID, sizeof (infoLog), &infologLength, infoLog); + DBG (String (infoLog, infologLength)); + jassertfalse; + } + #endif + + glAttachShader (programID, shaderID); + glDeleteShader (shaderID); +} + +void OpenGLShaderProgram::link() noexcept +{ + glLinkProgram (programID); + + #if JUCE_DEBUG + GLint status = 0; + glGetProgramiv (programID, GL_LINK_STATUS, &status); + jassert (status != GL_FALSE); + #endif +} + +OpenGLShaderProgram::Uniform::Uniform (const OpenGLShaderProgram& program, const char* const name) + : uniformID (glGetUniformLocation (program.programID, name)) +{ + jassert (uniformID >= 0); +} + +void OpenGLShaderProgram::Uniform::set (GLfloat n1) const noexcept { glUniform1f (uniformID, n1); } +void OpenGLShaderProgram::Uniform::set (GLint n1) const noexcept { glUniform1i (uniformID, n1); } +void OpenGLShaderProgram::Uniform::set (GLfloat n1, GLfloat n2) const noexcept { glUniform2f (uniformID, n1, n2); } +void OpenGLShaderProgram::Uniform::set (GLfloat n1, GLfloat n2, GLfloat n3) const noexcept { glUniform3f (uniformID, n1, n2, n3); } +void OpenGLShaderProgram::Uniform::set (GLfloat n1, GLfloat n2, GLfloat n3, float n4) const noexcept { glUniform4f (uniformID, n1, n2, n3, n4); } +void OpenGLShaderProgram::Uniform::set (GLint n1, GLint n2, GLint n3, GLint n4) const noexcept { glUniform4i (uniformID, n1, n2, n3, n4); } +void OpenGLShaderProgram::Uniform::set (const GLfloat* values, GLsizei numValues) const noexcept { glUniform1fv (uniformID, numValues, values); } diff --git a/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h b/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h new file mode 100644 index 0000000000..97ca4701b9 --- /dev/null +++ b/modules/juce_opengl/opengl/juce_OpenGLShaderProgram.h @@ -0,0 +1,111 @@ +/* + ============================================================================== + + This file is part of the JUCE library - "Jules' Utility Class Extensions" + Copyright 2004-11 by Raw Material Software Ltd. + + ------------------------------------------------------------------------------ + + JUCE can be redistributed and/or modified under the terms of the GNU General + Public License (Version 2), as published by the Free Software Foundation. + A copy of the license is included in the JUCE distribution, or can be found + online at www.gnu.org/licenses. + + JUCE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + ------------------------------------------------------------------------------ + + To release a closed-source product which uses JUCE, commercial licenses are + available: visit www.rawmaterialsoftware.com/juce for more information. + + ============================================================================== +*/ + +#ifndef __JUCE_OPENGLSHADERPROGRAM_JUCEHEADER__ +#define __JUCE_OPENGLSHADERPROGRAM_JUCEHEADER__ + +//============================================================================== +/** + Manages an OpenGL shader program. +*/ +class JUCE_API OpenGLShaderProgram +{ +public: + OpenGLShaderProgram() noexcept; + ~OpenGLShaderProgram() noexcept; + + /** Returns the version of GLSL that the current context supports. + E.g. + @code + if (OpenGLShaderProgram::getLanguageVersion() > 1.199) + { + // ..do something that requires GLSL 1.2 or above.. + } + @endcode + */ + static double getLanguageVersion(); + + /** Compiles and adds a shader to this program. + + After adding all your shaders, remember to call link() to link them into + a usable program. + + If your app is built in debug mode, this method will assert if the program + fails to compile correctly. + + The shaderType parameter is GL_VERTEX_SHADER or GL_FRAGMENT_SHADER + */ + void addShader (const char* const shaderSourceCode, GLenum shaderType); + + /** Links all the compiled shaders into a usable program. + If your app is built in debug mode, this method will assert if the program + fails to link correctly. + */ + void link() noexcept; + + /** Represents an openGL uniform value. + After a program has been linked, you can create Uniform objects to let you + set the uniforms that your shaders use. + + Be careful not to call the set() functions unless the appropriate program + is loaded into the current context. + */ + struct Uniform + { + /** Initialises a uniform. + The program must have been successfully linked when this + constructor is called. + */ + Uniform (const OpenGLShaderProgram& program, const char* uniformName); + + /** Sets a float uniform. */ + void set (GLfloat n1) const noexcept; + /** Sets an int uniform. */ + void set (GLint n1) const noexcept; + /** Sets a vec2 uniform. */ + void set (GLfloat n1, GLfloat n2) const noexcept; + /** Sets a vec3 uniform. */ + void set (GLfloat n1, GLfloat n2, GLfloat n3) const noexcept; + /** Sets a vec4 uniform. */ + void set (GLfloat n1, GLfloat n2, GLfloat n3, float n4) const noexcept; + /** Sets an ivec4 uniform. */ + void set (GLint n1, GLint n2, GLint n3, GLint n4) const noexcept; + /** Sets a vector float uniform. */ + void set (const GLfloat* values, int numValues) const noexcept; + + /** The uniform's ID number. + If the uniform couldn't be found, this value will be < 0. + */ + GLint uniformID; + }; + + /** The ID number of the compiled program. */ + GLuint programID; + +private: + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (OpenGLShaderProgram); +}; + +#endif // __JUCE_OPENGLSHADERPROGRAM_JUCEHEADER__ diff --git a/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp b/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp index 0716d35db6..877c6a10d3 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLTexture.cpp @@ -23,8 +23,6 @@ ============================================================================== */ -BEGIN_JUCE_NAMESPACE - OpenGLTexture::OpenGLTexture() : textureID (0), width (0), height (0) @@ -178,5 +176,3 @@ void OpenGLTexture::draw3D (float x1, float y1, float z1, OpenGLHelpers::drawQuad3D (x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4, colour); unbind(); } - -END_JUCE_NAMESPACE