Author Topic: Basic4gl  (Read 2410 times)

0 Members and 1 Guest are viewing this topic.

RobbeK

  • Guest
Basic4gl
« on: February 22, 2015, 01:38:18 PM »
Hi all,

found this interesting, ..    somewhat special,  it has lazy and / or   (land / lor )
not too slow , in the attached example the calculation of the primes  (the famous sieve ::  # upto 125000) takes less than a sec (newLISP 0.5 and Steel Bank CL 0.02sec)   -- but I forgot "step 2" in the sieve loop (no primes are even > 2) .. so even faster.
Pseudo 3D , the height stands for x²+y²  where x+iy is the Gaussprime. 

-------------------  source -------------------------

dim primes(2*260*250)   
dim i , j
dim pts = 1
dim x# , y# ,prime# , angle#

for i=1 to 2*250*250
 primes(i)=i
next

for i=3 to 250*250
 if (primes(i)>0) then
   j=2
     while i*j < 2*250*250
     primes(i*j)=0
     j=j+1
     wend
  end if
next
   

printr "ok"
 
glnewlist(pts,GL_COMPILE)

glBegin (GL_POINTS)
for x#=-200 to 200
  for y#=-200 to 200 
    prime#= x#*x#+y#*y#
    glColor3f (0,1,0)
  if primes(prime#)>0 then
     glVertex3f (x#/50,y#/50,-prime#/15000)
   end if 
   next
   next
 glEnd()
glendlist()

while true 
glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
glloadidentity()
glTranslatef (0, 0,-6)
glRotatef (angle#, 1, 1, 0)
glcalllist(pts)
swapbuffers() 

    while SyncTimer (10)
        angle# = angle# + 0.2
    wend
wend

---------------------------------------------------

makes standalones , runs perfectly under Wine too.

best Rob

.

JRS

  • Guest
Re: Basic4gl
« Reply #1 on: February 22, 2015, 01:44:32 PM »
All I can say is I'm glad you're not using JAPI and Linux is your home base. Life doesn't get better than that.  8)

RobbeK

  • Guest
Re: Basic4gl
« Reply #2 on: February 22, 2015, 02:24:17 PM »
Hi John,

I'm busy with FLTK for the moment (http://www.fltk.org/index.php) --  any experience ?   (got it working under FreePascal -- I should be able to write any lib for Windows and Linux now (to connect to Lisp)
I'm also going to concentrate on Steel Bank CL  , its  "alien interface"  works perfectly ,  tested  under Windows, Wine and Linux -- all running fine (even from Flash Drive)  (Clozure CL stand alones fail under Wine here ).

best, Rob

Japi, still ,  GNU CL , Bigloo Scheme , STALIN Scheme and also Basic4gl use it  (maybe the trend a decade ago) --  but, these will all crash under Wine , and the Japi.so (from Euphoria for Linux)seems to contain oddities (if not mistakes).
NewLISP comes with a subset of SWING these days ,  again I don't think it works under Wine, and making standalones is somewhat tricky
 
« Last Edit: February 22, 2015, 02:42:52 PM by RobbeK »