1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00
Commit graph

194 commits

Author SHA1 Message Date
reuk
e465b71188
Docs: Update language to be more diplomatic 2025-11-18 15:47:42 +00:00
attila
cb34975457 Fix crash after OpenGL::detach in the presence of buffered child components
The crash fixed by this commit could be triggered by attaching an OpenGL
context to a component, calling setBufferedToImage (true) on one of its
child components, and then detaching the OpenGL context from the parent.

Since 4ba01a80a0 we are creating images
with the current rendering context's native image type, so the above
scenario would leave an image buffer that references the detached
context.
2025-10-28 15:33:13 +01:00
reuk
c77e8a73cc
OpenGLContext (Android): Avoid potentially enqueuing work after context has already stopped 2025-07-10 14:59:18 +01:00
reuk
c134ca5d76
OpenGL (Android): Use a simpler approach to register SurfaceHolder callbacks 2025-07-09 11:30:28 +01:00
reuk
90b89e92b2
OpenGL: Respect result of getDesktopScaleFactor() for component hosting OpenGLContext 2025-07-09 11:28:03 +01:00
reuk
c2d52a5499
OpenGLFrameBuffer: Automatically save/restore content when the context is paused/resumed
This addresses an issue where OpenGL-backed image content could get lost
when putting and Android app into an inactive state. This happens
because the GL context gets destroyed, freeing all associated resources.

The workaround introduced here will listen for OpenGL state-change
events, and attempt to save and restore framebuffer content into main
memory, so that the content can be restored once the app is reactivated.
2025-07-09 11:24:43 +01:00
reuk
01821b5811
OpenGLFrameBuffer: Fix writePixels implementation, which previously blended instead of replacing existing pixels 2025-01-23 12:20:27 +00:00
reuk
93640b63ff
Compatibility: Add new macros for straightforward checking of minimum deployment target
This also fixes a bug introduced in f7c7225f5c
where the condition guarding the definition of traitCollectionDidChange
was incorrect. This function is never required if the deployment target
is at least 17.0.
2024-11-05 13:28:10 +00:00
attila
d9a3efd3cb ComponentPeer::VBlankListener: Add timestamp parameter to the vblank callback 2024-10-25 15:44:34 +02:00
reuk
10680f9bf7
OpenGL: Detach OpenGL context after initialisation 2024-10-24 20:43:10 +01:00
reuk
e2e3d949c7
OpenGL: Use C++ thread_local instead of JUCE ThreadLocal 2024-10-24 20:43:10 +01:00
reuk
90f37e27ea Windows: Fix DLL build
There were a few "ambiguous operator new/delete" errors that were due to
inheriting from a private base class that used the leak detector. These
errors are resolved by adding the leak detector to the derived classes.

JUCE_API was missing from a few useful types, notably the ARA hosting
types.
2024-10-22 13:24:46 +01:00
reuk
8754d87900 Windows: Fix build warnings when JUCE_DISABLE_ASSERTIONS is set 2024-09-13 13:57:10 +01:00
Anthony Nicholls
cddd43891d OpenGL: Stop calling disableScreenUpdatesUntilFlush on macOS 2024-08-14 15:35:50 +00:00
Tom Poole
94d98a2b10 Update licensing information 2024-04-16 11:39:35 +01:00
reuk
047448fbce
Warnings: Add missing overrides 2024-01-30 11:37:30 +00:00
attila
b0167985b4 OpenGLContext: Make getRenderingScale() sensitive to Component transforms
This also reverts commit c456f67c3f.
2024-01-03 14:02:42 +01:00
attila
c456f67c3f Windows: Make OpenGLContext::getRenderingScale() insensitive to Component transforms
This makes it consistent between Windows and MacOS. This is restoring
the behaviour prior to 7e404118b5.
2023-11-02 09:16:08 +00:00
reuk
8a9cb49c96
OpenGLContext: Add missing explicit keywords 2023-10-11 14:24:17 +01:00
reuk
9bf785f221
OpenGLContext: Re-bind previous program after copying texture 2023-10-11 14:24:17 +01:00
Tom Poole
6bf9bb9a2e Add final specifiers in implementation files 2023-10-10 16:12:38 +01:00
Tom Poole
9b041f3d74 Add a base clang-tidy configuration 2023-09-18 11:24:19 +01:00
reuk
17deafbb0d
OpenGL: Ensure a VAO is bound before calling user render callback 2023-08-01 13:41:30 +01:00
reuk
f012f8c280
OpenGL: Keep track of previously-attached VAOs and buffers when creating additional GL-backed Graphics contexts
Previously, code such as the following (where MyGLComponent is rendering
using an OpenGLContext) could result in GL errors, as the destruction of
the inner context unbound the array buffer and element array buffer
after use, instead of setting them to the previous values set up by the
outer context.

Additionally, a VAO was only set up in the OpenGLContext, so rendering
into a GL-backed LowLevel graphics context could fail if no VAO was
bound.

    void MyGLComponent::paint (juce::Graphics& g)
    {
        juce::Image image { juce::Image::PixelFormat::ARGB, width, height, false, juce::OpenGLImageType() };

        {
            juce::Graphics innerContext { image };
            // draw into innerContext
        }

        g.drawImage (image, juce::Rectangle<float> { width, height });
    }
2023-06-08 15:26:24 +01:00
reuk
28414a6af8
Global: Avoid floating-point equality checks where possible 2023-04-04 19:55:11 +01:00
Anthony Nicholls
05d5c94990
Native: Rename all native files for improved consistency 2023-04-04 19:54:29 +01:00
reuk
16929c26f7
OpenGLContext: Avoid calling NSView::window from displaylink thread 2023-03-14 19:08:07 +00:00
reuk
af2a4a7e2a
OpenGL: Avoid enabling GL_TEXTURE_2D in core profile contexts 2023-03-06 12:35:26 +00:00
reuk
c08a1827b5
OpenGL: Ensure flushBuffer can't be called simultaneously from multiple threads on macOS 10.13 or earlier
On these platforms, calling flushBuffer from multiple threads
simultaneously will lead to deadlocks.
2023-03-02 12:03:31 +00:00
reuk
ae45bb4c35
OpenGLContext: Fix signature of DEBUGPROC 2023-02-22 21:00:18 +00:00
reuk
f2d0d9cde8
OpenGL: Add back CVDisplayLink-driven drawing 2022-12-14 11:12:32 +00:00
reuk
0fbd7d7b3f
Functional: Add ScopeGuard implementation 2022-11-02 11:38:29 +00:00
reuk
7e404118b5
OpenGL: Correctly report OpenGL rendering scale in Pro Tools 2022.7 on Windows 2022-09-27 15:18:21 +01:00
reuk
19175ff698
OpenGL: Ensure that macOS uses the same (sRGB) colour space everywhere 2022-09-27 15:18:21 +01:00
reuk
2ae87f95f1
OpenGL: Carry out all GL rendering on a single thread 2022-09-27 15:18:21 +01:00
reuk
ae3bfdb1d2
OpenGL: Avoid occasional deadlock when destroying contexts 2022-09-26 18:03:47 +01:00
reuk
ff1d5d6da4
OpenGL: Only assert on high-severity errors 2022-09-26 18:03:47 +01:00
reuk
8ec8e36f5c OpenGLContext: Swap buffers on the main thread
This change fixes an issue where opening multiple OpenGLContexts on
certain versions of macOS (observed on 10.13) could cause a deadlock.

The issue can be reproduced by:
- Attaching an OpenGL context to the AudioPluginDemo editor
- Opening multiple copies of the editor simultaneously in a plugin host.
  I tested with Live 10.

I also observed the issue in a standalone app that opened new windows
containing OpenGLContexts on a timer.
2022-08-31 17:42:48 +01:00
reuk
322aa64459 OpenGLContext: Share CVDisplayLinks with NSViewComponentPeer 2022-08-31 17:42:47 +01:00
reuk
b27af5def9 OpenGL: Tidying 2022-08-31 17:42:47 +01:00
reuk
e64f87b26c OpenGL: Allow setting window bounds from repaint callback
On Windows, the OpenGL context window sometimes receives a repaint
request after moving between screens with different scale factors.
If the screen has changed size/scale since the last paint operation,
failing to invalidate the painted area may cause the screen contents
to be drawn at the wrong scale until paint is next called.
2022-08-31 17:42:47 +01:00
reuk
02b5ab748a OpenGL: Add support for a few more OpenGL profiles
- 4.1 and 4.3 contexts can now be requested
- The requested context version is no longer ignored on Linux
- Debugging contexts are now enabled in Debug builds with GL 4.3
- Fixes a bug where glEnable(GL_TEXTURE_2D) was called in core profiles
2022-08-31 17:42:47 +01:00
Tom Poole
2ec861d99e Update licensing banners to JUCE 7 2022-05-16 17:55:48 +01:00
Tom Poole
dea3fe60e4 Update copyright banners 2022-04-04 12:36:32 +01:00
reuk
45ae98effd
OpenGLContext: Correctly size GL view when using a non-unity global scale 2022-02-23 10:56:12 +00:00
reuk
d3c4017685
OpenGLContext: Only create and use a VAO in contexts using the core profile 2022-02-18 16:43:27 +00:00
reuk
01e71bc351
OpenGL: Avoid races on viewportArea and scale data members 2022-01-27 18:43:22 +00:00
reuk
1ff05d3333
OpenGL: Avoid querying the native view hierarchy from a background thread on macOS 2021-12-15 14:14:07 +00:00
reuk
48c6087faf Thread: Update macOS thread priority calculation
The Apple threading documentation [^1] says the following:

> The second argument to pthread_setschedparam is the desired policy,
  which can currently be one of SCHED_FIFO (first in, first out),
  SCHED_RR (round-robin), or SCHED_OTHER. The SCHED_OTHER policy is
  generally used for extra policies that are specific to a given
  operating system, and should thus be avoided when writing portable
  code.

This appears to differ from the policy semantics on Linux and BSD, where
FIFO and RR are both explicitly real-time policies.

Therefore, on Linux/BSD we only enable the RR policy if the requested
priority is 8 or higher. Meanwhile, on macOS, we map all thread
priorities (0 - 10) onto the RR policy with an appropriate priority.

[^1]: https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html
2021-12-14 22:50:09 +00:00
reuk
c5c9f080d3
OpenGL: Ensure context is initially drawn with correct scale on macOS 2021-12-03 10:15:51 +00:00