Author Topic: Oxygen Update  (Read 7775 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Oxygen Update
« on: December 25, 2013, 02:05:38 PM »

Charles Pegge

  • Guest
Re: Oxygen Update
« Reply #1 on: February 15, 2014, 03:43:57 AM »
February edition:

Ability to create dynamic arrays with LET syntax (still testing this feature)

type vector float x,y,z
let n=1000
let v=vector,n



Also:

Improved alignment rules for types/structures.

Support for multimensional array declarations in C headers.

Support for C-style multi-assignments: inner braces: ={ {..},{..},... }

Improved #show for displaying line assembly code


http://www.oxygenbasic.org/forum/index.php?topic=749.0


Time to remain indoors in front of a nice warm PC :)


« Last Edit: February 15, 2014, 04:48:10 AM by Charles Pegge »

Charles Pegge

  • Guest
Re: Oxygen Update
« Reply #2 on: February 15, 2014, 07:30:03 PM »
One further tweak was required for the new #show to work properly.

Also transferred  tools/ to ProjectsA/ in the in-progress zip

One of the tools, renamed FindIt has been revised and transferred to the main directory. It performs searches on groups of files. Works quite well with José Roca Headers, which is a demanding test in terms of size and number of files!

Typical search groups: (each separated by a blank line)
Code: [Select]
examples\Basics\*.*
examples\wingui\*.*
examples\opengl\*.*
examples\constructs\*.*
examples\basics\*.*

inc\*.*
inc\glo2\*.*
inc\glo2\gl\*.h

src\*.*

'VB 2004
\users\charles\desktop\BasicCands\WinApi2004.inc

'Jose Roca headers
\users\charles\desktop\BasicCands\JoseInc\*.inc

.

Charles Pegge

  • Guest
Re: Oxygen Update
« Reply #3 on: March 21, 2014, 02:46:25 PM »
Transparent Scene-Shots

All the demos using OpenglSceneFrame.inc can produce a sceneshot with ctrl-P. If the scene has a uniform background, it will also be possible to make the background transparent by keying shift-ctrl-P. This action will result in a png file instead of a jpeg.

The background color is read from the botton left pixel of the client area.

demos with this facility:

examples/Opengl/*.o2bas
projectsA/OpenglGui/viewer.o2bas

Click on the wizard for the latest version.

Charles Pegge

  • Guest
Re: Oxygen Update
« Reply #4 on: March 21, 2014, 03:15:10 PM »
OxIde.exe: Drag & Drop Editing and Execution of Scripts.


If you drop o2bas or bas file icons into the edit area of Oxide, the scripts will automatically load. If you drop them above the main edit area, they will also compile and execute.

I developed this when I discovered that it is nigh impossible to set up file associations for Ubuntu Wine applications. Anyway, I think this facility will be good for general use in native windows too.

PS: The austere Courier font can be changed by editing oxide.cfg, when oxide is not in use. For Windows, the nicest is probably Lucida console. And for Wine: Liberation Mono.

JRS

  • Guest
Re: Oxygen Update
« Reply #5 on: March 21, 2014, 07:37:12 PM »
I just download and installed O2 on my Windows 7 64 bit partition and tried the SDL fern demo with the new OxyIDE front end. I really like the drag/drop feature. Thanks for the O2 SDL interface source. At least now I don't have to beg Peter for docs or source to try and make his stuff work.

FYI: The fern seem to take a lot longer than what I would have expected. I even tried putting the flip() outside the loop to wait until it was finished. It helped but still too slow for an O2 app. The Mandelbrot and bouncing rings (I'm stealing that one) work fine. So far the fern demo is the only example that doesn't seem right.
« Last Edit: March 21, 2014, 07:49:00 PM by John »

Charles Pegge

  • Guest
Re: Oxygen Update
« Reply #6 on: March 22, 2014, 12:07:57 AM »
Hi John,

The SDL fern is slow due to 1 point-per-frame. It can be speeded up as fast as you please: This one runs 10x faster:

Code: [Select]
include "sdl.inc"

SetDisplay 640,500, 1
SetCaption "SDL FERN DEMO"

single a, b, c, d, e, f, newx, newy, sys r, wa
Dim xy(2) as single

Sub Fern
r = Rand(0,100)
iF r <= 10
   a = 0
   b = 0
   c = 0
   d = 0.16
   e = 0
   f = 0
ElseiF r > 1 and r <=86
   a = 0.85
   b = 0.04
   c = -.04
   d = 0.85
   e = 0
   f = 1.60
ElseiF r > 86 and r <=93
   a = 0.2
   b = -.26
   c = 0.23
   d = 0.22
   e = 0
   f = 0.16
Else
   a = -.15
   b = 0.28
   c = 0.26
   d = 0.24
   e = 0
   f = 0.44
End iF
newx = ((a * xy(1)) + (b * xy(2)) + e)
newy = ((c * xy(1)) + (d * xy(2)) + f)
xy(1) = newx
xy(2) = newy
SetPixel xy(1)*40+275,xy(2)*40+50, 0,210,55
End Sub

ClsColor 28,28,28
wa=0
do
  for i=1 to 10
    wa++
    if wa=30000 or key(27) then exit do
    Fern
  next
  SetCaption "Fern Points:  " + str(wa)
  Flip
end do
WaitKey(27)
Ends

PS: none of these SDL demos work under UBUNTU/Wine, and GDIplus is a bit shaky too. Maybe its the DLL versions I am using.

I am expecting the blus screen any moment now. But time enough to write this message :)

PPS: After Ubuntu reboot, SDL is now working properly.
« Last Edit: March 22, 2014, 12:47:35 AM by Charles Pegge »

JRS

  • Guest
Re: Oxygen Update
« Reply #7 on: March 22, 2014, 07:21:03 AM »
Thanks Charles!

I'll give the new fern example a try.

OT:

Even though I like Windows 7 better than XP, it's slower than Linux. Windows 64 bit is mostly running on new, experimental, ... drivers from major open source projects. I guess no one thought MS was ever going to get to 64 bit and it's a waste land on this platform.


JRS

  • Guest
Re: Oxygen Update
« Reply #8 on: March 22, 2014, 10:58:18 AM »
Something is still not right. SB is doing 30,000 iterations like O2 but your results seem more dense. I modified your version to display execution time.

BTW: Why does O2 have such a problem with t2-t1/1000 or (t2-t1)/1000 ? I had to get very basic with the expression to return the desired results.

Peter's O2 SDL fern example
Code: [Select]
include "sdl.inc"

SetDisplay 640,500, 1
SetCaption "SDL FERN DEMO"
single a, b, c, d, e, f, newx, newy, sys r, wa, t1, t2, t3
Dim xy(2) as single

Sub Fern
r = Rand(0,100)
iF r <= 10
   a = 0
   b = 0
   c = 0
   d = 0.16
   e = 0
   f = 0
ElseiF r > 1 and r <=86
   a = 0.85
   b = 0.04
   c = -.04
   d = 0.85
   e = 0
   f = 1.60
ElseiF r > 86 and r <=93
   a = 0.2
   b = -.26
   c = 0.23
   d = 0.22
   e = 0
   f = 0.16
Else
   a = -.15
   b = 0.28
   c = 0.26
   d = 0.24
   e = 0
   f = 0.44
End iF
newx = ((a * xy(1)) + (b * xy(2)) + e)
newy = ((c * xy(1)) + (d * xy(2)) + f)
xy(1) = newx
xy(2) = newy
SetPixel xy(1)*40+275,xy(2)*40+50, 0,210,55
End Sub

t1 = SDL_GetTicks
ClsColor 28,28,28
wa=0
do
  for i=1 to 10
    wa++
    if wa=30000 or key(27) then exit do
    Fern
  next
  SetCaption "Fern Points:  " + str(wa)
  Flip
end do
t2 = SDL_GetTicks
t3 = t2 - t1

PRINT t3 / 1000
WaitKey(27)
Ends

Script BASIC GFX fern example
Code: [Select]
' ScriptBasic GFX - Fern

IMPORT gfx.inc

s = gfx::Window(640,500,"ScriptBasic GFX Fern")
RANDOMIZE(gfx::Time())
SPLITA STRING(3,"0") BY "" TO xy

SUB Fern
r = RND() % 100
IF r <= 10 THEN
   a = 0
   b = 0
   c = 0
   d = 0.16
   e = 0
   f = 0
ELSE IF r > 1 AND r <=86 THEN
   a = 0.85
   b = 0.04
   c = -.04
   d = 0.85
   e = 0
   f = 1.60
ELSE IF r > 86 AND r <=93 THEN
   a = 0.2
   b = -.26
   c = 0.23
   d = 0.22
   e = 0
   f = 0.16
ELSE
   a = -.15
   b = 0.28
   c = 0.26
   d = 0.24
   e = 0
   f = 0.44
END IF
newx = ((a * xy[1]) + (b * xy[2]) + e)
newy = ((c * xy[1]) + (d * xy[2]) + f)
xy[1] = newx
xy[2] = newy
gfx::pixelRGBA s, INT(xy[1]*40+300), INT(-xy[2]*40+450), 0, 210, 55, 255
END SUB

ts = gfx::Time()
FOR w=1 TO 30000
    Fern
NEXT
te = gfx::Time()
gfx::stringColor s, 20, 15, "Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
gfx::Update
WHILE gfx::KeyName(1) <> "+escape"
WEND
gfx::Close



.
« Last Edit: March 22, 2014, 12:08:55 PM by John »

Charles Pegge

  • Guest
Re: Oxygen Update
« Reply #9 on: March 22, 2014, 11:28:03 AM »
It's Peter's code, BTW. The pixels are extra large. (t2-t1)/1000 is the right expression, but you will have to use explicit brackets with the print function, due to the leading left bracket.

print ( (t2-t1)/1000 )

better solution, also eliminating the expensive division operator:

print 0.001*(t2-t1)

Something a little more exotic:

You can temporarily suppress the rules of operator precedence and use left-to-right evaluation

#noprec print t2-t1*0.001
« Last Edit: March 22, 2014, 11:38:29 AM by Charles Pegge »

JRS

  • Guest
Re: Oxygen Update
« Reply #10 on: March 22, 2014, 11:37:10 AM »
Quote
It's Peter's code, BTW.

I'm assuming you mean the fern example not the SDL interface?


Charles Pegge

  • Guest
Re: Oxygen Update
« Reply #11 on: March 22, 2014, 11:40:51 AM »
The SDL inc file is also Peter's :)

He made inc files for GDI and GDI+ too.
« Last Edit: March 22, 2014, 11:52:07 AM by Charles Pegge »

JRS

  • Guest
Re: Oxygen Update
« Reply #12 on: March 22, 2014, 12:02:10 PM »
Good to see Peter come around and make it worthwhile to improve on his library. At least I'm no longer programming blind.

Charles Pegge

  • Guest
Re: Oxygen Update
« Reply #13 on: March 22, 2014, 12:11:42 PM »
Peter produced all these examples before his DLL phase :)

JRS

  • Guest
Re: Oxygen Update
« Reply #14 on: March 22, 2014, 12:37:18 PM »
Peter produced all these examples before his DLL phase :)

Old code.  :(

I would remove it from your zip then.