Help with shaders!
Posted: Sat Nov 04, 2023 6:25 am
Hello! I'm a relatively new game dev and trying to make a doom style game called delta.
I decided to make a table of screen colors and use custom functions to draw rectangles, lines, circles, ect and render the screen to make it the same resolution on different computers in full screen. Unfortunately to do this I decided to render all the table values, and with the massive resolution of 480x270 I have to go though 129,600 pixels to do this. This is a pretty big task for my old CPU and I think I should use the GPU instead.
the code:
I do know you can do this using shaders but I have no idea how to do this. Can you help me make a shader for this.
Also anyway to lock the resolution in fullscreen with out doing all this then that would be preferred.
edit:Forgot to add the .love file lol,
I decided to make a table of screen colors and use custom functions to draw rectangles, lines, circles, ect and render the screen to make it the same resolution on different computers in full screen. Unfortunately to do this I decided to render all the table values, and with the massive resolution of 480x270 I have to go though 129,600 pixels to do this. This is a pretty big task for my old CPU and I think I should use the GPU instead.
the code:
Code: Select all
--resolution[1] is the width
--resolution[2] is the height
--render screen
for y=1,resolution[2],1 do
for x=1,resolution[1],1 do
screen.r[x][y]=0
screen.g[x][y]=0
screen.b[x][y]=0
end
end
--draw things
--clear screen
for y=1,resolution[2],1 do
for x=1,resolution[1],1 do
graphics.setColor(screen.r[x][y],screen.g[x][y],screen.b[x][y])
graphics.rectangle('fill',(x-1)*(width/resolution[1]),(y-1)*(height/resolution[2]),(width/resolution[1]),(height/resolution[2]))
end
end
Also anyway to lock the resolution in fullscreen with out doing all this then that would be preferred.
edit:Forgot to add the .love file lol,