[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] More optimisation questions



On Fri, 2005-12-16 at 12:15 +0900, Guillaume Proux wrote:
>         glBindTexture(GL_TEXTURE_2D, self.newtexture)
>         glPixelStorei(GL_UNPACK_ROW_LENGTH,
> self.textureSurface.get_width());
>         glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
> self.textureSurface.get_width(), self.textureSurface.get_height(),
> GL_RGBA, GL_UNSIGNED_BYTE, self.textureData)
> 
> because this is too slow, i miss a refresh.

This may be tricky to speed up. What resolution images are you using
here? Are you sure there are not other parts of your texture loading
that slow things down? Are you calling pygame.image.load() and
pygame.image.tostring() in this same block of code? Breaking those out
into separate frames would be a big help. You should be able to load
pygame Surfaces in a background thread, as well as call "tostring".