I'm not sure how many people hear are familair with python, pygame or pyOpenGl but hopefully you can help. The problem i have is with performance speed.
am working on some code at the moment where my program will be sent an image string and i then show it in a pyOpenGl window. This happens continuously . The code i have works but is very slow. The code i am currently using is
glBindTexture( GL_TEXTURE_2D, self.textures[i])
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST )
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR )
gluBuild2DMipmaps( GL_TEXTURE_2D, 4, 640, 480, GL_RGBA, GL_UNSIGNED_BYTE, self.image_strings[i])
At the moment the image width and height is not base 2 which is why i'm using mipmaps. Currently the back-end is not completed and can not send me a string. I am mimicking this by using an array of image strings (self.image_strings) untill it is ready.
After this code i call this to apply the texture
if self.max_frame > 1:
self.frame = self.frame + self.direction
if self.frame == self.max_frame - 1 or self.frame == 0:
self.direction *= -1
glAlphaFunc( GL_GREATER, 0.15 )
glTexCoord2f(0.0, 0.0); glVertex3f(-1.0, -1.0, 0) # Bottom Left Of The Texture and Quad
glTexCoord2f(1.0, 0.0); glVertex3f( 1.0, -1.0, 0) # Bottom Right Of The Texture and Quad
glTexCoord2f(1.0, 1.0); glVertex3f( 1.0, 1.0, 0) # Top Right Of The Texture and Quad
glTexCoord2f(0.0, 1.0); glVertex3f(-1.0, 1.0, 0)
posting this right now i notice that i call glBindTexture twice; do i need to do this ( i will test it), and would it make a difference. From what i read the only way i can make this faster while still using mipmapping would be to create a thread for the load image so while it loads it won't stop the program, in some type of weired double buffering way.
Any help is appreciated
Thanks in advance