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

722 commits

Author SHA1 Message Date
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
3d8a97c1c1
Android: Update bytecode minimum version requirements 2025-09-17 12:50:06 +01:00
Tom Poole
360dfe5f3d Bump version number to 8.0.10 2025-09-15 09:30:11 +01:00
Tom Poole
cb9ec7e38f Bump version number to 8.0.9 2025-09-01 14:44:25 +01:00
reuk
5eba9a6434
OpenGL: Clear bound texture after rendering transparency layer
A change introduced in 00836d1e94 meant
that GL renderers could sometimes assert in
StateHelpers::ActiveTextures::bindTexture() when ending a transparency
layer.

Specifically, the issue was provoked by adding the ScopedTextureBinding
in the constructor of OpenGLFrameBuffer. This reset the bound texture
after creating a new transparency layer.

I think the previous implementation worked by accident, not by design.
It so happens that when rendering multiple transparency layers within
the same frame (i.e. calling begin/end several times in that order,
*not* nesting the calls), the same texture ID will generally get reused.

From the graphics context's (GC's) perspective, we create a texture with
ID "2", then call bindTexture() to bind it, and the GC remembers that
this ID is bound. We draw the frame, and the texture gets destroyed. The
call to glDeleteTextures() will cause the default texture, "0", to be
bound if the texture being destroyed is bound at the point of
destruction. So, after the texture is destroyed, the GC's stored binding
no longer reflects reality, since texture "0" is now bound.

The next time we create a texture, that texture also gets created with
ID "2". Previously, we would leave this texture bound after
construction, but now we re-bind the previously-bound texture, "0". This
causes the assertion in bindTexture() to fire when we next attempt to
bind texture "2", since the actual bound texture is "0".

The solution added in this patch will bind texture "0" when the
transparency layer image is destroyed, in order to keep the GC's view of
the GL context consistent with the real state.
2025-08-14 14:13:09 +01:00
reuk
2712f63628
Graphics: Use unique_ptr instead of raw pointers in RenderingHelpers 2025-08-14 14:13:09 +01:00
Anthony Nicholls
36d07a6ce3 Docs: Replace doxygen preprocessor conditionals with @cond and @endconds 2025-07-21 18:11:43 +02:00
reuk
f5a6c510c0
OpenGLFrameBuffer: Add a row order parameter for reading and writing pixels
This also fixes a bug where saving and restoring the framebuffer state
could unexpectedly apply a vertical flip to the buffer content.
2025-07-10 16:16:12 +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
17e13c22fc
Android: Fix scaling of bounds and input coordinates for components using a custom desktop scale factor 2025-07-09 11:28:03 +01:00
reuk
90b89e92b2
OpenGL: Respect result of getDesktopScaleFactor() for component hosting OpenGLContext 2025-07-09 11:28:03 +01:00
reuk
ac65cc5434
OpenGLFrameBuffer: Add early-exit in ~TransientState 2025-07-09 11:27:48 +01:00
reuk
1900dd4e4a
OpenGLFrameBuffer: Use ScopeGuard to unbind framebuffer 2025-07-09 11:27:34 +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
fc2caf0a4d
OpenGLFrameBuffer: Refactor to move stored OpenGLContext out of TransientState 2025-07-09 11:24:43 +01:00
reuk
29af89c72a
OpenGLFrameBuffer: Refactor pimpl to represent mutually exclusive states with std::variant 2025-07-09 11:24:43 +01:00
reuk
80c4268a5d
OpenGLFrameBuffer: Refactor SavedState in implementation to allow copying and moving 2025-07-09 11:24:43 +01:00
reuk
3991089409
OpenGLFrameBuffer: Refactor pimpl to completely hide SavedState 2025-07-09 11:24:43 +01:00
reuk
0da5827f72
OpenGLFrameBuffer: Remove unused members in implementation 2025-07-09 11:24:43 +01:00
reuk
416da229f2
OpenGLFrameBuffer: Remove outdated info from docs 2025-07-09 11:24:43 +01:00
Anthony Nicholls
0181f52c48 OpenGL: Document blend parameter for copyTexture method 2025-06-10 16:13:33 +01:00
Tom Poole
b0d569c74b Bump version number to 8.0.8 2025-06-02 09:24:54 +01:00
reuk
1fcdd29bf9
OpenGL: Return image BitmapData in JUCE order rather than native order
JUCE convention is that BitmapData holds the lines of the image ordered
from top to bottom, but OpenGL orders lines in the reverse direction.
By returning a negative line stride, we can iterate lines in the
expected order as long as we always increment the current pointer
position by the line stride after processing each line.
2025-05-19 13:32:52 +01:00
reuk
fb4159c436
OpenGL: Fix state restoration when drawing into a temporary nested context
Fixes a regression introduced in
bd26d79b17

The issue was observed in the DemoRunner when enabling the OpenGL
renderer and then switching to the LookAndFeel V1.

The cause of the problem was the creation of a secondary OpenGL-backed
Graphics instance in the DropShadowEffect. This temporary context could
modify the OpenGL context state without restoring the state
appropriately on destruction. As a result, when the outer long-lived
OpenGL context resumed drawing, properties such as the viewport, bound
shader, shader uniform values, and bound framebuffer could all be
incorrect.
2025-05-19 13:30:27 +01:00
reuk
00836d1e94
OpenGLFrameBuffer: Keep track of the previously-bound framebuffer 2025-05-19 13:30:27 +01:00
Oli
250abe9cf4 LowLevelGraphicsContext: Add preferred image type for temporary images
Co-authored-by: Matt Gonzalez <matt@echoaudio.com>
2025-04-24 13:58:23 +01:00
Tom Poole
99b752a1d2 Bump version number to 8.0.7 2025-04-08 10:51:07 +01:00
Oliver James
9c8a2b9609 OpenGL (Windows): Only trigger async update after first buffer swap
This fixes an issue where OpenGL would continuously repaint on Windows.
2025-02-11 10:43:17 +00:00
reuk
2fbb72d960
OpenGLFrameBufferImage: Refactor and simplify BitmapData releaser 2025-01-23 12:21:33 +00:00
reuk
01821b5811
OpenGLFrameBuffer: Fix writePixels implementation, which previously blended instead of replacing existing pixels 2025-01-23 12:20:27 +00:00
reuk
2d01e326db
ObjCHelpers: Rename makeCGRect from makeNSRect 2025-01-23 12:20:27 +00:00
tpoole
0baffff182 Bump version number to 8.0.6 2025-01-10 09:29:00 +00:00
tpoole
902ddc7567 Bump version number to 8.0.5 2025-01-08 14:23:21 +00:00
reuk
29e6bee01f
OpenGL: Fix mouse-move handling for OpenGL views
Since b108fe26c3, JUCE NSViews have
ignored mouse movements for child views. However, this causes issues for
OpenGL views, which still expect to receive mouse input via the parent
view. This fix makes the inner OpenGL view effectively invisible to the
mouse, so all mouse events are handled by the owning JUCE view.
2024-12-19 22:58:33 +00:00
reuk
0aafcdbb4c
OpenGL: Adjust formatting to reduce line lengths 2024-12-19 22:57:36 +00:00
reuk
21357f26b5 OpenGLTexture: Respect pixelStride when loading Image to texture 2024-12-13 14:42:26 +00:00
reuk
dcca72484f Image: Update return type of getPixelData to avoid dangling pointers 2024-12-13 14:42:26 +00:00
Anthony Nicholls
5e803ded5f Deprecations: Add ignore deprecation warning macros 2024-11-27 11:07:04 +00:00
Tom Poole
71af005543 Bump version number to 8.0.4 2024-11-18 10:12:15 +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
4bc2952419
OpenGL: Set up context sharing on the GL thread, rather than the main thread
wglShareLists will only succeed when the shared context is not currently
active on another thread, but it is difficult to ensure that the GL
thread is paused/inactive at any given time - in particular, it's very
easy to accidentally introduce deadlocks where the main thread waits for
the render thread's lock while the render thread waits for the
messagemanager lock.

The simplest way to ensure that no other thread has activated the shared
context is to share the contexts directly on the render thread itself.
2024-10-24 20:43:10 +01: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
fcaf5adb25
OpenGL: Avoid displaying OpenGL window until a frame has been drawn
This avoids an issue where, when attaching an OpenGLContext as a child
of a window rendered with Direct2D, the area covered by the OpenGL
renderer would display as a white rectangle until the context had
drawn a frame. This only affected the Direct2D renderer; when the parent
window used the software renderer, no white rectangle was shown.
2024-10-24 20:43:09 +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
Tom Poole
14c8d06fb0 Bump version number to 8.0.3 2024-10-15 22:16:12 +01:00
Tom Poole
c1d2846e47 Bump version number to 8.0.2 2024-09-26 08:31:50 +01:00
reuk
8754d87900 Windows: Fix build warnings when JUCE_DISABLE_ASSERTIONS is set 2024-09-13 13:57:10 +01:00