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

[pygame] More optimisation questions



Hi,
Recently I was playing with PyOpenGL/pygame to make some kind of nice
display of pictures in OpenGL. Basically, a series of picture are
loaded IN SEQUENCE (the basic idea is that there are two many of them
so we can't batch load them and insert them into texture without
exploding texture memory limits), so they must be lazy loaded.

I have a simple loop that display two QUADs with texture blended with
each other to enable a very gratifying clean dissolve. This works
marvellously. However, as soon as I try to add another object (for
example a cube that I have put in a display list earlier), the
movement of the cube becomes glitchy because it seems that it takes
more than is left of the 1/60s of the frame (which is the refresh rate
of my monitor) to do the following

        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.

I tried to move the picture loading + texture uploading to a different
thread but it would seemingly not allow me to do just that code above
in a different thread.

Any idea gentlemen (and ladies if any in the assistance...Any game
programming lady on this list?)?

Regards,

Guillaume