Peter Hi all, a question: I draw an image pixel-wise with Raylib, in C. Currently I do this: for(y=0; y<YSIZE; y++) { for(x=0;x<xSIZE; x++) { CALCULATE VALUE BeginDrawing(); DrawPixel(x, y, VALUE); EndDrawing(); } } How can I make the output faster?
TPW Don't know about raylib, but in SDL2 the solution for such problems usually is to render larger textures or rects instead of single pixels, and it seems from a quick search that something similar might work for raylib. If that ain't no option, splitting the operation into different threads might also help a bit.
Peter Thanks for the infos. The larger rectangles ain't an option in this special case. Running it in parallel could be helpful, thanks for the tip. Edit: The link you gave contains multiple solutions. I will dig into them. :)
ffaf I also suspect that BeginDrawing() and EndDrawing() could be called just once, the first before the for cycle and the latter after the for cycle.
Peter ffaf Yes, I thought so, too. But when I placed those calls at the bginning and end of the program, it didn't work. And to place them immediatly before/after the for-loop I first have to rearrange,the code hevily.
Peter It turns out Raylib isn't well-suited for what I have in mind. I will try OpenGL framebuffer and (perhaps) Linux framebuffer device. In both cases you can put pixel values simply into a mem area and then swap the framebuffers. Should be the fastest possible solution for my goal.