I have been playing with pygames to draw points on a surface using the following code.
# First loop for number of ileratitations, screen is refreshed once each loop.for x in range (0,500):
#pygame.display.update()
pygame.display.update()
#rects = [pygame.Rect(0,0,0,0)]
windowSurface.fill(BLACK)
# Loop to update each star in turn, write the screen pixel back to background, draw new pixel and save the areas for the screen refresh task.
for star in StarA:
star[6] = (star[0]*cosT[star[4]]) + star[2]
star[7] = (star[1]*sinT[star[4]]) + star[3]
star[4] = star[4] + star[5]
if star[4] >= 359:
star[4] = 0
windowSurface.set_at((int(star[6]), int(star[7])), WHITE)
#rects.append(pygame.Rect(star[6],star[7],1,1))
as you can see I tried both full screen updates and just updating the changed pixels. however they real performance hit in the graphic is not the screen update. but the drawing of each star/pixel (there are 200 stars in StarA) this is where the time is taken when i profile the script.
So can any one suggest a better method to draw this to screen? I don't need to use pygames as the only reason I have done so it the nice simple interface. but I am more concerned with performance as this is running on a raspberry pi, and I would like to get it running with 1000+ stars at 25+FPS. Now I know i can pre calculate all the data points if needed, so it outputting to screen that I need to work on. The pi does have a GPU, but no idea how to make best use of it. I feel at the moment I am doing it in the most basic way and could get it to work a lot better.
Cheers