Hi there,
first I’d like to apologize for my lack of understanding of the
blitting process with SDL. Since I’ve been using SDL for a long time,
just to jump into opengl. I’ve been using SDL only for window
management, user input and networking (using sdl_net). Now, I got my
hands on some data I need to draw on screen, it consists of points of
colors, pixels if you like, but they may not be together, rather
randomly placed on the whole surface. The result might remind one of
some falling snow, except that the snow of pixels will be coming in
waves and at a very high rate. At this rate, opengl is not making it
into the competition, i need faster access and I know sdl can be much
better in some 2D circumtances.
At every iteration some points will appear and others will disappear,
now, I’m wondering what is the best way to implement a refresh screen
algorythm. The problem is that some of these algos will work better
than the other depending on the amount of changing pixels.
The first algo i will use, which will probably be what I’ll base
myself on when comparing other algorythms, the first one will be using
the putpixel function, one pixel at a time, then probably calling a
refresh on the whole screen for simplicity.
For my next algo, I was thinking on pasting all that on a surface and
making a mask for this surface before blitting the surface on the screen
surface. Now I’ve never done any of this and I’ll probably have a hard
time to deal with my data. Maybe I can have my function spit out the
pixels in the surface with the correct format already. Right now it is
a one dimensional array of unsigned char[WIDTH * HEIGHT * 3], and the
colors are aligned as {RGBRGBRGB…} one byte per color, 3 bytes per pixel.
Best would be to find a way to get this alignment for the pixels of
the screen surface, and then I can forget about blitting and simply
write the output of my calculation at the right place in the screen’s
pixels.
I’ll probably need a lot of help, so if you’ve got any experience of
this kind of process, please share what you think.
Thanks,
Simon