Online Rubic's Cube SimulatorThe direction I would like to see happen with this challenge is use the JavaScript version as a guide to rework the O2
Pine Cone GL example. I personally don't have the skills level with graphics programming to do the merge. I'm just the facilitator in this effort.
If this materializes, I suggest we call it
RobbeK's Cube as a tribute
#compact
% Title "PineCone"
% Animated
% ScaleUp
'% PlaceCentral
'% AnchorCentral
'% NoEscape
% ColorCodedPick
% MultiSamples 4
includepath "$\inc\"
include "ConsoleG.inc"
function makelist() as sys
==========================
type coor float x,y,z
static coor z
static float golden_angle = 137.508
static float golden = golden_angle*Pi/180
macro floret(n, r,ang,xc,yc) 'inner procedure
----------------------------
float r , ang , xc , yc
r =(5.3 * Sqr(n*golden))
ang = (n*golden)
xc = r*Cos(ang)/100
yc = r*Sin(ang)/100
z.x=xc : z.y=yc
end macro
sys i
static sys seeds
seeds=CompileList seeds
for i=1 to 140
floret(i)
glPushMatrix
glTranslatef z.x , z.y , i/100
scale 0.11+i/900
go sphere
glPopMatrix
next
for i=144 To 1 step -1
floret(i)
glPushMatrix
glTranslatef -z.x , -z.y , 2.2-i/200
Scale 0.11+i/1000
go sphere
glPopMatrix
next
glEndList
return seeds
end function
function main()
===============
sys i,p
string s
float a
cls 0,0.1,0.2
'
shading
'
pushstate
move 15,-15,-20
static MoveableObject seeds
static sys seedform
static sys idf
if not idf
idf=100
seeds.snap=.5
seeds.id=idf
seeds.mode=0x100 'keyboard & mouse (left button rotate)
SeedForm=MakeList()
end if
picked=idf 'always selected
seeds.act
scale 10
move 0,0,-1
'static float ay
'rotateY ay : ay+=.2
if not pick then
SilverMaterial.act
end if
go SeedForm
'go cylinder
popstate
'
'F1 HELP
'
if key[0x70]
flat
pushstate
move 20,0
color .9,.9,.9
scale 1.5,1.0
printl "Active Keys:"
printl
scale 1/1.5,1.0
printl "Esc" tab "Exit"
printl "Ctrl-P" tab "Take snapshot"
printl "F1 This help panel"
printl "Arrow keys PgUp PgDn to move"
printl "Ctrl Arrow keys PgUp PgDn to rotate"
printl "+ - keys to scale up and scale down"
printl "Ctrl Home to reset rotation"
printl "Shift for faster movement"
printl
scale 1.5,1.0
printl "Mouse:"
printl
scale 1/1.5,1.0
printl "Point to Object, then"
printl "Left button to move"
printl "Middle button to scale"
printl "Right button to rotate"
printl "Wheel to move in Z direction"
popstate
end if
picklabel 0
lastkey=0
lastchar=0
end function
EndScript
Attached is Mike's 32 bit version of RobbeK's contribution. (.exe)