Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Pixel Data Display PROOF OF CONCEPT

Back in the older days of the NES and the C64, graphics were stored as bits of data stored in ROM or RAM. Since then, it's been easier to "import" graphics instead of storing their data. Unfortunately, that causes manipulating color data to be more difficult. Thus, I present to you, a start on my project, which just renders pixel data (sine of the pixel coord plus ElapsedTime)

function setup()
    displayMode(FULLSCREEN)
    rectMode(CORNER)
    FPS=0 --      -\   Used for
    framcnt=0 --    > Calculating 
    lastscnd=0 -- _/     FPS
    pxSizeW=25 --Width of pixels
    pxSizeH=25 --Height of pixels
    parameter.watch("FPS")
end

-- This function gets called once every frame
function draw()
    noStroke()
    noSmooth() --Smoothing tended to make a stroke-like effect
    for y=1,pxSizeH*50,pxSizeH do
        for x=1,pxSizeW*50,pxSizeW do
            fill(math.sin(y-ElapsedTime)*100+100, 0, math.sin(x-ElapsedTime)*100+100)
            rect(x,y,pxSizeW,pxSizeH)
        end
    end

    --Code down here calculates FPS
    framcnt = framcnt + 1
    if (ElapsedTime > lastscnd + 1) then
        lastscnd = lastscnd + 1
        FPS=framcnt
        framcnt = 0
    end
end
Tagged:

Comments

Sign In or Register to comment.