Cleanup: Remove extra glFlush calls from a few places.

glFlush may make the program wait until the GL driver has forwarded all commands to the GPU. glFlush is already called once in the main loop just before swapping buffers and checking for user input.
This commit is contained in:
David Vierra 2012-11-20 14:33:31 -10:00
parent 8cf1bdeb87
commit a8978445d3
2 changed files with 5 additions and 7 deletions

View File

@ -157,7 +157,7 @@ class TabPanel(Widget):
i = (x - m) * n // width
if 0 <= i < n:
return i
def gl_draw_self(self, root, offset):
self.gl_draw(root, offset)
@ -166,7 +166,7 @@ class TabPanel(Widget):
if len(pages) > 1:
tlcorner = (offset[0] + self.bottomleft[0], offset[1] + self.bottomleft[1])
pageTabContents = []
pageTabContents = []
current_page = self.current_page
n = len(pages)
b = self.tab_border_width
@ -182,7 +182,7 @@ class TabPanel(Widget):
surface = Surface(self.size, SRCALPHA)
glEnable(GL_BLEND)
for i, page in enumerate(pages):
x1 = x0+tabWidth
selected = page is current_page
@ -197,8 +197,8 @@ class TabPanel(Widget):
offs = ((tabWidth - r.size[0])/2) + m +((s+tabWidth)*i)
surface.blit(buf, (offs, m))
x0 = x1 + s
x0 = x1 + s
data = image.tostring(surface, 'RGBA', 1)
rect = self.rect.move(offset)
w, h = root.size
@ -214,6 +214,5 @@ class TabPanel(Widget):
glDrawPixels(self.width, self.height,
GL_RGBA, GL_UNSIGNED_BYTE, fromstring(data, dtype='uint8'))
glPopAttrib()
glFlush()
glDisable(GL_BLEND)

View File

@ -750,7 +750,6 @@ class Widget(object):
GL.glDrawPixels(self.width, self.height,
GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, fromstring(data, dtype='uint8'))
GL.glPopAttrib()
GL.glFlush()
def gl_draw_self(self, root, offset):
pass