Skip to content

Commit c56e995

Browse files
committed
Read pixels directly in RenderedTarget::updateHullPoints()
1 parent b53e5cd commit c56e995

File tree

2 files changed

+0
-22
lines changed

2 files changed

+0
-22
lines changed

src/renderedtarget.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -397,19 +397,10 @@ void RenderedTarget::updateHullPoints(QOpenGLFramebufferObject *fbo)
397397
m_hullPoints.clear();
398398
m_hullPoints.reserve(width * height);
399399

400-
// Blit multisampled FBO to a custom FBO
401-
QOpenGLFramebufferObject customFbo(fbo->size());
402-
glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, fbo->handle());
403-
glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, customFbo.handle());
404-
glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
405-
glBindFramebuffer(GL_FRAMEBUFFER_EXT, customFbo.handle());
406-
407400
// Read pixels from framebuffer
408401
size_t size = width * height * 4;
409402
GLubyte *pixelData = new GLubyte[size];
410403
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
411-
glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
412-
fbo->bind();
413404

414405
// Flip vertically
415406
int rowSize = width * 4;

test/renderedtarget/renderedtarget_test.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -325,19 +325,6 @@ TEST_F(RenderedTargetTest, HullPoints)
325325
target.updateHullPoints(&fbo);
326326
ASSERT_EQ(target.hullPoints(), std::vector<QPointF>({ { 1, 1 }, { 2, 1 }, { 3, 1 }, { 1, 2 }, { 3, 2 }, { 1, 3 }, { 2, 3 }, { 3, 3 } }));
327327

328-
// Begin painting (multisampled)
329-
format.setSamples(16);
330-
QOpenGLFramebufferObject fboMultiSampled(4, 6, format);
331-
fboMultiSampled.bind();
332-
painter.beginFrame(fboMultiSampled.width(), fboMultiSampled.height());
333-
334-
// Paint (multisampled)
335-
painter.drawImage(image, 0, 0);
336-
painter.endFrame();
337-
338-
// Test hull points (this is undefined with multisampling, so we just check if there are any hull points)
339-
ASSERT_FALSE(target.hullPoints().empty());
340-
341328
// Release
342329
fbo.release();
343330
context.doneCurrent();

0 commit comments

Comments
 (0)