mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
OpenGLFrameBuffer: Fix writePixels implementation, which previously blended instead of replacing existing pixels
This commit is contained in:
parent
5f7d6d70fc
commit
01821b5811
3 changed files with 14 additions and 6 deletions
|
|
@ -1525,14 +1525,22 @@ struct DepthTestDisabler
|
|||
void OpenGLContext::copyTexture (const Rectangle<int>& targetClipArea,
|
||||
const Rectangle<int>& anchorPosAndTextureSize,
|
||||
const int contextWidth, const int contextHeight,
|
||||
bool flippedVertically)
|
||||
bool flippedVertically,
|
||||
bool blend)
|
||||
{
|
||||
if (contextWidth <= 0 || contextHeight <= 0)
|
||||
return;
|
||||
|
||||
JUCE_CHECK_OPENGL_ERROR
|
||||
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable (GL_BLEND);
|
||||
if (blend)
|
||||
{
|
||||
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glEnable (GL_BLEND);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable (GL_BLEND);
|
||||
}
|
||||
|
||||
DepthTestDisabler depthDisabler;
|
||||
|
||||
|
|
|
|||
|
|
@ -332,8 +332,8 @@ public:
|
|||
void copyTexture (const Rectangle<int>& targetClipArea,
|
||||
const Rectangle<int>& anchorPosAndTextureSize,
|
||||
int contextWidth, int contextHeight,
|
||||
bool textureOriginIsBottomLeft);
|
||||
|
||||
bool textureOriginIsBottomLeft,
|
||||
bool blend = true);
|
||||
|
||||
/** Changes the amount of GPU memory that the internal cache for Images is allowed to use. */
|
||||
void setImageCacheSize (size_t cacheSizeBytes) noexcept;
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ bool OpenGLFrameBuffer::writePixels (const PixelARGB* data, const Rectangle<int>
|
|||
glViewport (0, 0, pimpl->width, pimpl->height);
|
||||
pimpl->context.copyTexture (area, Rectangle<int> (area.getX(), area.getY(),
|
||||
tex.getWidth(), tex.getHeight()),
|
||||
pimpl->width, pimpl->height, true);
|
||||
pimpl->width, pimpl->height, true, false);
|
||||
|
||||
JUCE_CHECK_OPENGL_ERROR
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue