EDIT: solved it, i figured some pixel values were not set as INTEGERs, what caused the errors in the assignment to the array
I have been working on a portal based rendering graphics engine, like DukeNukem, Shadow Warrior and the like, where the screen gets renderened in vertical lines. For each x coordinate there are at least three y- lines (floor,main,ceiling), and often more when other sectors are seen through respective portals.
Everything works fine and smooth, until i started using the setpixel instruction instead of drawline. I figured out from the forum that setpixel does not use opengl and is quite slow therefore.
However to apply textures and lightning, i need individual pixel access, so i had the idea to write the pixels to a pixel buffer instead of drawing immediate points. I think this is also the way its done with SDL c++.
Anyway the following code works horrible. It works somehow and has quite good speed compared to setpixel but I can barley recognize the scene: between 50k and 70k pixels are lost out of 307.000 (640 x 480) and dont get rendered at all, it seems like.
How can i deal with this?
GLOBAL W = 640, H = 480
LOADSPRITE "texture.png", 0 //640x480 dummy
GLOBAL pix%[];SPRITE2MEM(pix%[], 0);
MEM2SPRITE(pix%[], 1, W, H) //work with this copy
WHILE TRUE
CalculatePixels() // All pixels get assigned in here
MEM2SPRITE(pix%[],1,W,H)
DRAWSPRITE 1, 0,0
Showscreen
WEND