includepath "$\inc\"
$ FileName "t.exe"
'include "RTL32.inc"
'include "RTL64.inc"
$ title "Lines + coordinate_system"
include "OpenglSceneFrame.inc"
sub initialize(sys hWnd)
'=======================
end sub
'
sub scene(sys hWnd)
'==================
'
double i
static single s1,s2,s3,s4,ang1,angi1=1,ra,ri
'
glLoadIdentity
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glClearColor 0.5, 0, 0, 0
'
'
glrotatef ang1, 0,0,1
gltranslatef 0,0,-1
glscalef 0.001,0.001,0.001
'
glLineWidth 3.0
'
glBegin GL_LINES
glColor4ub 250,250,150,250
glVertex2i -100,-100
glVertex2i 100, 100
glColor4ub 150,250,250,250
glVertex2i -100, 100
glVertex2i 100,-100
glEnd
'
glLineWidth 2.0
'
ri=0
glBegin GL_LINE_LOOP
for i=0 to 360 step 10
ra=rad(i)
glVertex2f cos(ra)*(170+ri),sin(ra)*(170+ri)
ri=30-ri
next
glEnd
'---------------------- new ------------------------- //
glLineWidth 2.0
glBegin GL_LINES
glColor4ub 250,250,0,250
'---------------- //
' -- x axis -------------
glVertex2i -505,0
glVertex2i 505,0
' -- y axis -------------
glVertex2i 0,505
glVertex2i 0,-505
glColor4ub 0,0,250,250
' -- how to set small vertical lines on x axes and horizontal lines on y axes ? ---------------
' -- vertical marks on x axes ----- doesn't work here -----------
for i = -405 to 405
glVertex2i i, -1.5 ' patterns like this one: --l--l--l--l--l--
glVertex2i i, 1.5 ' patterns like this one: --l--l--l--l--l--
glVertex2i -1.5,i
glVertex2i 1.5,i
next
' -- horizontal marks on y axes ----- doesn't work here -----------
glEnd
'---------------- end new ---------------- //
'
'ang1+=angi1
if ang1>360 then ang1-=360
'
end sub
sub Release(sys hwnd)
'====================
end sub
include "asm.inc"
include "asmgl.inc"
hwnd = window 640,480,1
init3D hwnd
double i
single s1,s2,s3,s4,ang1,angi1=1,ra,ri
while keydown(27)=0
ClearBuffer 0.5,0,0,0
SetMatrix
glrotatef ang1,0.0,0.0,1.0
gltranslatef 0.0,0.0,-1.0
glscalef 0.002,0.002,0.0
glLineWidth 3.0
glBegin GL_LINES
glColor4ub 255,255,255,255
glVertex2i -100,-100
glVertex2i 100, 100
glColor4ub 150,250,250,250
glVertex2i -100, 100
glVertex2i 100,-100
glEnd
glLineWidth 2.0
ri=0
glBegin GL_LINE_LOOP
for i=0 to 360 step 10
ra=rad(i)
glVertex2f cos(ra)*(170+ri),sin(ra)*(170+ri)
ri=30-ri
next
glEnd
glLineWidth 2.0
glBegin GL_LINES
glColor4ub 250,250,0,250
glVertex2i -505,0
glVertex2i 505,0
glVertex2i 0,505
glVertex2i 0,-505
glColor4ub 0,0,250,250
for i = -405 to 405
glVertex2i i,-1.5
glVertex2i i, 1.5
glVertex2i -1.5, i
glVertex2i 1.5, i
next
glEnd
DoEvents
SwapBuffer
SetFps 60
wend
Quit3D
WinExit
includepath "$\inc\"
$ FileName "t.exe"
'include "RTL32.inc"
'include "RTL64.inc"
$ title "Lines + coordinate_system"
include "OpenglSceneFrame.inc"
sub move(optional float x,y,z)
==============================
glTranslatef x,y,z
end sub
'--------------------------------------
sub linescale(optional float r,a,b,w)
=====================================
float i
float c,d
if not r then r=10.00 'length of line
if not a then a= 1.00 'tick interval
if not b then b= 0.4 'tick size
if not w then w= 5.0 'major interval count
glLineWidth 2
glBegin GL_LINES
'glColor4ub 0,0,250,250
glVertex2f .0 , .0
glVertex2f r , .0
glend
'ticks
glLineWidth 1
glBegin GL_LINES
do
glVertex2f i,.0
if mod(c,w)=0 then d=-b*2 else d=-b
glVertex2f i,d
i+=a
c+=1.0
if i>r then exit do
end do
glEnd
end sub
sub initialize(sys hWnd)
'=======================
end sub
'
sub scene(sys hWnd)
'==================
'
double i 'float i
static single s1,s2,s3,s4,ang1,angi1=1,ra,ri
'
glLoadIdentity
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glClearColor 0.5, 0, 0, 0
'
'
glrotatef ang1, 0,0,1
gltranslatef 0,0,-1
glscalef 0.001,0.001,0.001
'
glLineWidth 2.0
'
ri=0
glBegin GL_LINE_LOOP
for i=0 to 360 step 10
ra=rad(i)
glColor4ub 250,50,150,250
glVertex2f cos(ra)*(170+ri),sin(ra)*(170+ri)
ri=30-ri
next
glEnd
'
'--------------- my idea -------------------- //
move -500,-16
'linescale 20.0, 1.0, 0.3, 5 'X AXIS
glColor4ub 0,0,250,250
linescale 500.0, 10.0, 20.3, 5 'X AXIS
move 500,-0
glColor4ub 0,250,0,250
linescale 500.0, 10.0, 20.3, 5 'X AXIS
glRotatef -90,0,0,1 '90,0,0,1
'move -500,0
glColor4ub 0,250,250,250
linescale 500.0, 10.0, 20.3, 5 'Y AXIS
glRotatef 0,0,0,1
move -500,0
glColor4ub 0,250,250,250
linescale 500.0, 10.0, 20.3, 5 'Y AXIS
glEnd
'--------------- my idea -------------------- //
'ang1+=angi1
if ang1>360 then ang1-=360
'
end sub
sub Release(sys hwnd)
'====================
end sub
pushstate
move 0,-1.5
pushstate : move 00 : print "0.0" : popstate
pushstate : move 10 : print "10.0" : popstate
pushstate : move 20 : print "20.0" : popstate
popstate
line-based printing is very simple:
includepath "$\inc\"
$ FileName "t.exe"
'include "RTL32.inc"
'include "RTL64.inc"
$ title "Rotating Lines"
include "OpenglSceneFrame.inc"
sub initialize(sys hWnd)
'=======================
end sub
'
sub scene(sys hWnd)
'==================
'
static single s1,s2,s3,s4,ang1,angi1=1,ra,ri
static hlps
'
glLoadIdentity
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glClearColor 0.5, 0, 0, 0
'
'
glrotatef ang1, 0,0,1
gltranslatef 0,0,-1
glscalef 0.001,0.001,0.001
'
glLineWidth 3.0
'
glBegin GL_LINES
glColor4ub 250,250,150,250
glVertex2i -100,-100
glVertex2i 100, 100
glColor4ub 150,250,250,250
glVertex2i -100, 100
glVertex2i 100,-100
glEnd
'
glLineWidth 2.0
'
ri=0
glBegin GL_LINE_LOOP
for i=0 to 360 step 10
ra=rad(i)
glVertex2f cos(ra)*(170+ri),sin(ra)*(170+ri)
ri=30-ri
next
glEnd
'
'CONTROL WITH KEYBOARD KEYS
'static hlps
glDisable GL_LIGHTING
'
'F1 HELP
'if hlps
glLoadIdentity
glPushMatrix
'gltranslatef -.5,.28,-1.
gltranslatef 0.0,0.0,-1.0
float w,h
glColor3f .00,.99,.99
glScalef 0.001,0.001,0.001
glScalef '.07,.07,.01
gprint "Help:",.7
glColor3f .99,.99,.99
glScalef .5,.5,1.
gprint "mouse to select object and drag.",1.
gprint "number keys to select object 1..3.",1.
gprint "arrow keys to move selected object.",1.
gprint "shift+arrow keys to rotate.",1.
glPopMatrix
hlps=0
'end if
'
'ang1+=angi1
if ang1>360 then ang1-=360
'
end sub
sub Release(sys hwnd)
'====================
end sub
includepath "$\inc\"
$ FileName "t.exe"
'include "RTL32.inc"
'include "RTL64.inc"
$ title "Rotating Lines"
$ fontA "Arial",FW_SEMIBOLD
include "OpenglSceneFrame.inc"
sub initialize(sys hWnd)
'=======================
end sub
'
sub scene(sys hWnd)
'==================
'
static single s1,s2,s3,s4,ang1,angi1=1,ra,ri
static hlps
'
glLoadIdentity
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glClearColor 0.5, 0, 0, 0
'
'
glrotatef ang1, 0,0,1
gltranslatef 0,0,-1
glscalef 0.001, 0.001, 0.001
'
glLineWidth 3.0
'
glBegin GL_LINES
glColor4ub 250,250,150,250
glVertex2i -100,-100
glVertex2i 100, 100
glColor4ub 150,250,250,250
glVertex2i -100, 100
glVertex2i 100,-100
glEnd
'
glLineWidth 2.0
'
ri=0
glBegin GL_LINE_LOOP
for i=0 to 360 step 10
ra=rad(i)
glVertex2f cos(ra)*(170+ri),sin(ra)*(170+ri)
ri=30-ri
next
glEnd
'
glDisable GL_LIGHTING
'
'F1 HELP
glLoadIdentity
glPushMatrix
'gltranslatef -.5,.28,-1.
gltranslatef 0.0,0.0,-1.0
glColor3f .00,.99,.99
glScalef .07,.07,.01
gprint "Help:",.7
glColor3f .99,.99,.99
glScalef .5,.5,1.
gprint "mouse to select object and drag.",1.
gprint "number keys to select object 1..3.",1.
gprint "arrow keys to move selected object.",1.
gprint "shift+arrow keys to rotate.",1.
glPopMatrix
'ang1+=angi1
if ang1>360 then ang1-=360
'
end sub
sub Release(sys hwnd)
'====================
end sub
'
' openGL example, oxygenbasic, lines, marks, text, sinus curve, 09.nov.2014
' by frankolinox (frank brĂ¼bach, bsa)
'
includepath "$\inc\"
$ FileName "t.exe"
'include "RTL32.inc"
'include "RTL64.inc"
$ title "Lines + coordinate_system, Text+Sinus Curve"
$ fontA "Arial",FW_SEMIBOLD
include "OpenglSceneFrame.inc"
sub move(optional float x,y,z)
==============================
glTranslatef x,y,z
end sub
'--------------------------------------
sub linescale(optional float r,a,b,w)
=====================================
float i
float c,d
if not r then r=10.00 'length of line
if not a then a= 1.00 'tick interval
if not b then b= 0.4 'tick size
if not w then w= 5.0 'major interval count
glLineWidth 2
glBegin GL_LINES
'glColor4ub 0,0,250,250
glVertex2f .0 , .0
glVertex2f r , .0
glend
'ticks
glLineWidth 1
glBegin GL_LINES
do
glVertex2f i,.0
if mod(c,w)=0 then d=-b*2 else d=-b
glVertex2f i,d
i+=a
c+=1.0
if i>r then exit do
end do
glEnd
end sub
sub initialize(sys hWnd)
'=======================
end sub
'
sub scene(sys hWnd)
'==================
'
double i 'float i
static single s1,s2,s3,s4,ang1,angi1=1,ra,ri
static hlps
'
glLoadIdentity
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glClearColor 0.5, 0, 0, 0
'
'
glrotatef ang1, 0,0,1
gltranslatef 0,0,-1
glscalef 0.001,0.001,0.001
'
glLineWidth 3.0
'
glBegin GL_LINES
glColor4ub 250,250,150,250
glVertex2i -100,-100
glVertex2i 100, 100
glColor4ub 150,250,250,250
glVertex2i -100, 100
glVertex2i 100,-100
glEnd
glLineWidth 2.0
'
ri=0
glBegin GL_LINE_LOOP
for i=0 to 360 step 10
ra=rad(i)
glColor4ub 250,50,150,250
glVertex2f cos(ra)*(170+ri),sin(ra)*(170+ri)
ri=30-ri
next
glEnd
'
' ------- sinus / Cosinus curve -------------------- //
ri=30
glLineWidth 2
glBegin GL_LINES
for i = -500 to 500 step 0.1 '0.1
glColor4ub 250,0,0,250
glVertex2f i*ra, sin(i)*ri 'ra
glVertex2f i*ra+0.1, sin(i+0.1)*ri
glColor4ub 0, 255, 0,250
glVertex2f i*ra, cos(i)*ri
glVertex2f i*ra+0.1, cos(i+0.1)*ri
next
glEnd
' ------- sinus / Cosinus curve -------------------- //
move -500,-16
'linescale 20.0, 1.0, 0.3, 5 'X AXIS
glColor4ub 0,0,250,250
linescale 500.0, 10.0, 20.3, 5 'X AXIS
move 500,-0
glColor4ub 0,250,0,250
linescale 500.0, 10.0, 20.3, 5 'X AXIS
glRotatef -90,0,0,1
glColor4ub 0,250,250,250
linescale 500.0, 10.0, 20.3, 5 'Y AXIS
glRotatef 0,0,0,1
move -500,0
glColor4ub 0,250,250,250
linescale 500.0, 10.0, 20.3, 5 'Y AXIS
glEnd
'------------- gprint text passage ---------------- //
glDisable GL_LIGHTING
'
glLoadIdentity
glPushMatrix
'gltranslatef -.5,.28,-1.
'gltranslatef 0.0,0.0,-1.0
gltranslatef 0.05,-0.08,-1.0
glColor3f .00,.99,.99
glScalef .07,.07,.01
gprint "Avengers:",.7
glColor3f .99,.99,.99
glScalef .5,.5,1.
gprint "Thor, Hulk.",1.
gprint "Captain America, Iron Man.",1.
gprint "Black Widow, Hawkeye.",1.
glColor3f .99,.90,.05
gprint "Giant, Spiderman, Wesp.",1.
glScalef .75,.75,0.75
gprint "have fun with these heroes, good evening :).",1.
glPopMatrix
'------------- gprint text passage ---------------- //
'ang1+=angi1
if ang1>360 then ang1-=360
'
end sub
sub Release(sys hwnd)
'====================
end sub