From 4f76aace96589be1d0ba65ef8aff0efaa361249a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 7 Dec 2011 09:47:23 +0000 Subject: [PATCH] Search images in more framebuffer attachments. --- driver.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/driver.py b/driver.py index 1c4904c..871ef09 100755 --- a/driver.py +++ b/driver.py @@ -343,17 +343,28 @@ class TestCase: def getImage(self, callNo): state = self.getState(callNo) - framebuffer = state['framebuffer'] if self.doubleBuffer: - imageObj = framebuffer['GL_BACK'] + attachments = ['GL_BACK', 'GL_BACK_LEFT', 'GL_BACK_RIGHT', 'GL_COLOR_ATTACHMENT0'] else: - imageObj = framebuffer['GL_FRONT'] + attachments = ['GL_FRONT', 'GL_FRONT_LEFT', 'GL_FRONT_RIGHT', 'GL_COLOR_ATTACHMENT0'] + imageObj = self.getFramebufferAttachment(state, attachments) data = imageObj['__data__'] stream = StringIO(base64.b64decode(data)) im = Image.open(stream) im.save('test.png') return im + def getFramebufferAttachment(self, state, attachments): + framebufferObj = state['framebuffer'] + for attachment in attachments: + try: + attachmentObj = framebufferObj[attachment] + except KeyError: + pass + else: + return attachmentObj + raise Exception("no attachment found") + def getState(self, callNo): try: state = self.stateCache[callNo] -- 2.43.0