Have you noticed how, sometimes, simple things suddenly become b****y complicated?
Here's a simple example. I merely wanted to compare the times taken to load lots of shaders, create lots of objects and apply lots of shaders.
Here's the code:
set display mode 1024, 768, 32
sync on: sync rate 0: sync
autocam off
position camera 0, 0, -500
point camera 0, 0, 0
color backdrop rgb(64, 128, 96)
center text screen width()/2, screen height()/2, "LOADING, ETC ... PLEASE WAIT"
sync
null = make vector4(1)
set vector4 1, 0.57735, -0.57735, 0.57735, 0.0
load image "chainMail.png", 1
load image "chainMail nMap.png", 2
time1 = timer()
for i = 1 to 500
load effect "ggbump01.fx", i, 0
set effect constant vector i, "lightDir", 1
set effect constant float i, "specLevel", 2.0
set effect constant float i, "specExpon", 10.0
next i
time2 = timer() - time1
for i = 1 to 500
make object sphere i, 50
position object i, rnd(500) - 250, rnd(400) - 150, rnd(500) - 200
texture object i, 0, 1
texture object i, 1, 2
next i
time3 = timer() - time2
for i = 1 to 500
set object effect i, i
next i
time4 = timer() - time3
global cx#
global cy#
cx# = camera angle x()
cy# = camera angle y()
angleStep# = 1.0
angle# = 0.0
repeat
text 20, 20, "time to load effects = " + str$(time2) + " ms"
text 20, 40, "time to make objects = " + str$(time3) + " ms"
text 20, 60, "time to apply effects = " + str$(time4) + " ms"
text 20, 90, "fps = " + str$(screen fps()) + " ms"
inc angle#, angleStep#
rotateObjects(angle#)
sync
until spacekey()
end
function rotateObjects(angle#)
for i = 1 to 500
xrotate object i, angle#
next i
endfunction
And here's a screenshot which took less than a minute to appear:
Just look at the time taken to create the objects. Where did that figure come from?
I've probably made a stupid coding error which I can't see - and, yes, I'm using my ancient PC.
Full project plus media in my next post (on this thread before you ask

).