spriteBuffer broken
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PyGL3Display |
In Progress
|
Low
|
David Griffin |
Bug Description
This is an reproducer to create some strange behaviour.
It uses the SpriteFont class from the textexample.
The text rendered before the main loop is fine, the text that is rendered inside is wrong.
It is flickering wrong letters, see screenshot text_bug_
Removing the use of spriteBuffer fixes this. So I guess that spriteBuffer is broken.
Here is what I have installed:
Python 2.7.2 on Windows 7 64bit
PyOpenGL-
pygame-
pygl3display r104
-------
import sys
from pygl3display import *
configure('pygame')
import random
import pygame
from pygl3display.
from pygl3display import SpriteBuffer, SpriteGroup, topLeftOffsets, Sprite
class SpriteFont(object):
def __init__(self, font, size):
chars = ' abcdefghijklmno
chars += '/?!"$%
font = pygame.
self.height = 0
for char in chars:
def makeString(self, string):
"""Creates a SpriteGroup which renders the string."""
lines = string.split('\n')
sprites = []
ypos = 0
maxXpos = 0
for line in lines:
xpos = 0
for char in line:
if char in self.fontmap:
maxXpos = max(xpos, maxXpos)
ypos += self.height
ret = SpriteGroup(
return ret
GLCommon.
font = SpriteFont(
text2=font.
text2.setPositi
text3=font.
text3.setPositi
while 1:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key== pygame.K_ESCAPE:
if event.type == pygame.QUIT:
tick=
t="%s %i" % ( pygame.
text = font.makeString(t)
text4 = font.makeString
text4.
GLCommon.
-------
SpriteBuffer is one of the things I'm currently looking at. They used to exist because creating sprites was relatively slow - I'm not sure if this is still the case. If it's not, SpriteBuffers will be killed off completely. If making Sprites is still slow, then I will be completely rewriting SpriteBuffers anyway, because at the moment they require a __del__ method which can cause problems for Pythons GC.
This may take a bit longer than the other bugs; I'm currently tight on time due to a car accident that happened a couple of days ago (no injuries, car written off) and dealing with all the problems that caused. Same for the other bug you reported, I'm afraid. But way to go giving PyGL3Display a proper shake-down.
In the meantime, probably the best bet is to not use SpriteBuffers, but just create Sprites directly.