Post by hedgehog7777 on Mar 6, 2020 16:51:59 GMT -5
2023,feb.01 ,find: best flyer:3d_space_scr.zip
'*****************************************************************************************************************************************************************************
the best ability to fly in 3D is here to be found:3d_space_scr.zip (90.18 KB)
the flyer is based on gluLookAt. Use WASD to fly forward. The basic isn't working, only the exe.
for guests:download with mediafire:
www.mediafire.com/file/uk1dwe2j293z09t/3d_space_scr.zip/file
'*****************************************************************************************************************************************************************************
keys in test_02.exe (112 KB) www.mediafire.com/file/nyo5mr1w7uw01rw/keys_in_test_02.exe/file
Fractal_sponger: 80.03.10a.03.rotate.07.03L4h3.zip
drive.google.com/drive/folders/1dIXj8Saq9uyP_psgVARWFHZbXefbnX2U
( request B4Gl_code: write an email to chuck.summer@mail.com )
'*****************************************************************************************************************************************************************************
3:39 PM 3/6/2020
Lately i found an older 4gl window in the basic4gl-demo-programs between pages 1 and 30 and
we could improve and accomplish v1.0:
'
every window keeps its number
window 1- 5: box turn left
window 7-10: box turn right
window 6 : box turn with mouse_x() and mouse_y()
'*****************************************************************************************************************************************************************************
'4glB-window v1.01 :3D window openGL_09.10.fin
'... somewhere found in :basic4gl-demo-programs between pages 1-30
'PCNew, public and combination
'
declare sub draw_all_windows() :declare sub one_Window(i0,p0,p1,s0,s1) :declare sub draw3D_box(i1,i0) :declare sub draw_border(i0,i1)
declare sub gln_v3f(i0,i1,i2,i3,i4,i5) :declare sub draw_minimize(i0,i1) :declare sub draw_menu_bar(i0,i1) :declare sub draw_if_not_mini(i0,p0,p1,s0,s1)
declare sub w(i0) :declare sub info(i0) :declare sub f01_()
declare sub f11() :declare sub win_minimized(i0)
'*****************************************************************************************************************************************************************
dim LightAmbient#(3): LightAmbient# = vec4 (.5, 1, .5, 1) ' Lighting
dim LightDiffuse#(3): LightDiffuse# = vec4 (.5, 1, .5, 1)
dim LightPosition#(3):LightPosition# = vec4 (0, 10, 20, 1)
'------------------------------------------------------------------------------------------------------------------------------------------------
glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient#) ' light thats always there.
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse#) ' light coming from a source.
glLightfv(GL_LIGHT1, GL_POSITION,LightPosition#) ' where the light source is.
glEnable(GL_LIGHT1) ' enable the light source.
'------------------------------------------------------------------------------------------------------------------------------------------------
dim a$
dim b,c
dim i0,i2,i2#
dim f01,f02,f03
dim i,i7,i8,i9
dim lmb,lmb2
dim md,mx2,my2
dim win_nr(10)
'------------------------------------------------------------------------------------------------------------------------------------------------
struc swindow ' Structure to hold information about the window-
dim frames ' how many times the window has been drawn
dim minimized ' state of the window
dim size#(1) ' x and y size (in pixels)
dim pos# (1) ' x and y position (in pixels, starting at lower left hand corner)
dim normalSize# (1) ' used to store size when minimized
dim mouse# (1) ' position of the mouse cursor on the window
dim nr#
endstruc
'------------------------------------------------------------------------------------------------------------------------------------------------
dim mouse# (1) ' mouse position
dim lastMouse# (1) ' mouse position previous frame
'dim mouseDown (2) ' true if mouse is down
dim lmcl ' true if mouse is clicked
'
dim swindow window (10) ' array of windows
dim swindow &win ' pointer to a window structure- for simplifying code.
'
dim drawArray (10) ' array used to draw windows in order- recently used are drawn last (over the top of previous ones).
dim windowCount ' how many windows there are
dim activeWindow ' which window is currently active
dim ClosestClickedWindow' used to determine if another window was clicked on other than the active window.
'------------------------------------------------------------------------------------------------------------------------------------------------
for i = 0 to 10:window (i).pos# = vec2 (100+i*40,50+i*20):window (i).size# = vec2 (400, 300):drawArray (i) = i:window (i).nr#=i:next:windowCount = i
'
TextMode (TEXT_OVERLAID)
'******************************************************************************************************************************************************************
do
lastMouse# = mouse#
mouse#(0) = Mouse_X () * WindowWidth ()
mouse#(1) =(1-Mouse_Y())*WindowHeight()
lmb = Mouse_Button(0)
'
f11()
'
if lmb then
&win = &window (activeWindow)
if lmb then win.mouse# = mouse# - win.pos# :endif
'
f01_():
if f01 then
if win.Mouse#(1) > win.size#(1)-20 then
if win.Mouse#(0) <= win.size#(0)-20 then win.pos# = win.pos# + mouse#-lastMouse#
else
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
win_minimized(win.minimized)
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
endif
endif
else 'if f01
closestClickedWindow = -1
for i = 0 to windowCount-1
&win = &window (drawArray (i))
win.mouse# = mouse# - win.pos# '-
f01_():if f01 then closestClickedWindow = i :endif
next
'
if not closestClickedWindow = -1 then ActiveWindow = DrawArray (closestClickedWindow)
for i = closestClickedWindow to WindowCount-2 :DrawArray (i) = DrawArray (i+1):next :
DrawArray (WindowCount-1) = ActiveWindow
endif
endif'if f01
win.mouse# = mouse# - win.pos#
endif'if lmb
'
draw_all_windows()
loop
sub win_minimized(i0)
if lmcl then f03=true
if i0=0 then
win.normalSize# = win.size#
win.size#(0) = 150
win.size#(1) = 20
win.pos# = win.pos# - win.size# + win.normalsize#
win.minimized = true
endif
if i0 =true then
win.pos# = win.pos# + win.size# - win.normalSize#
win.size# = win.normalSize#
win.minimized = false
endif
endif
end sub
'*********************************************************************************************************************************************
sub f11()
if f02=0 and lmb then lmcl = true:f02=true:endif
if f02 and f03 then lmcl=0 :endif
if f02 and not lmb then f03=0:f02=0 :endif
end sub
'*********************************************************************************************************************************************
sub f01_():f01 = win.mouse#(0)>=0 and win.mouse#(1)>=0 and win.mouse#(0)<=win.size#(0) and win.mouse#(1)<=win.size#(1):end sub
sub draw_all_windows()
glClearColor (0, 0, 0, 0)
glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
glEnable (GL_SCISSOR_TEST)
for i = 0 to windowCount-1 : w(i):one_Window(i2,win.pos#(0),win.pos#(1),win.size#(0),win.size#(1)) :: next
glDisable (GL_SCISSOR_TEST)
SwapBuffers ()
end sub
sub w(i0):&win = &window (drawArray (i0)):i2=win.nr#:end sub
'
sub one_Window(i0,p0,p1,s0,s1): info(1)
'
glLoadIdentity () :glScissor (p0, p1, s0, s1) :glViewport (p0, p1, s0, s1)
glClearColor (.5, .5, .5, 1):glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) ' Clear out all previous information from the scissor rectangle.
'
glMatrixMode (GL_PROJECTION)
glLoadIdentity ()
glOrtho (0, s0, 0, s1, -1, 1) ' Set 2D mode
glMatrixMode (GL_MODELVIEW)
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
draw_menu_bar( win.size#(0),win.size#(1) )
draw_minimize( win.size#(0),win.size#(1) ) ' Minimize button
draw_border( win.size#(0),win.size#(1) )
draw_if_not_mini(i0,win.pos#(0),win.pos#(1),win.size#(0),win.size#(1))
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
end sub
sub info(i0):if i0=1 then
' Only draw a rectangle the size of the window. This is done
' by using glScissor, which makes it so only the scissored
' part of the screen is drawn to. Also reset the viewport so
' the coordinates behave the same way they would if they were
' drawn in a normal opengl window.
endif:end sub
'
sub draw_if_not_mini(i0,p0,p1,s0,s1)' Draw what's inside the window if it's not minimized.
if not win.minimized then
glScissor (p0+2,p1+2, s0-4, s1-22) ' Clip the draw area to within the window border- two units on each
glViewPort (p0+2,p1+2, s0-4, s1-22) ' side, 2 units on the bottom and 20 units for the top.
'
glclearColor (.1, .1, .1, .1)
glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
'
glMatrixMode (GL_PROJECTION) ' Set 3D mode
glLoadIdentity ()
gluPerspective (60, (1.0*s0)/s1, 1, 1000)
glMatrixMode (GL_MODELVIEW)
'
draw3D_box(i0,win.frames)
endif
end sub
'
sub draw_menu_bar(i0,i1)
if drawArray (i) = ActiveWindow then
glBegin (GL_QUADS)
glColor3f (0, 0, .5) : glVertex2f ( 0, i1-20)
glColor3f (0, .1, .5) : glVertex2f (i0, i1-20)
glColor3f (0, .5, .2) : glVertex2f (i0, i1)
glColor3f (0, .2, .2) : glVertex2f ( 0, i1)
glEnd ()
else
glBegin (GL_QUADS)
glColor3f (.1, 0, .1) : glVertex2f ( 0, i1-20)
glColor3f (.1, .1, .1) : glVertex2f (i0, i1-20)
glColor3f (.1, .1, .2) : glVertex2f (i0, i1)
glColor3f (.1, .2, .2) : glVertex2f ( 0, i1)
glEnd ()
endif
end sub
'
sub draw_minimize(i0,i1)
glBegin (GL_QUADS)
glColor3f (.5, .5, .5): glVertex2f (i0 -18, i1 - 18)
glColor3f (.3, .3, .3): glvertex2f (i0 - 2, i1 - 18)
glColor3f (.5, .5, .5): glVertex2f (i0 - 2, i1 - 2)
glColor3f (.3, .3, .3): glVertex2f (i0 -18, i1 - 2)
glEnd ()
end sub
'
sub draw_border(i0,i1)
glBegin (GL_QUADS) :glColor3f (0, 0, .5)
glVertex2f (0, 0) :glVertex2f (2, 0)
glVertex2f (2, i1 - 20) :glVertex2f (0, i1 - 20)
glVertex2f (2, 0) :glVertex2f (i0-2, 0)
glVertex2f (i0-2, 2) :glVertex2f (2, 2)
glVertex2f (i0 -2, 0) :glVertex2f (i0 -2, i1 - 20)
glVertex2f (i0,i1 - 20) :glVertex2f (i0 , 0 )
glEnd ()
end sub
'
sub draw3D_box(i1,i0):
ResizeText (25, 15) :printr "3D OpenGL Windows:";i1;" "
locate 0,2:print "lmc:";lmcl
locate 0,3:print "md:" ;
locate 0,4:print "lmb:";lmb
locate 0,5:print "i8:" ;i8
locate 0,6:print "i9:" ;i9
locate 0,7:print "i1:" ;i1:a$=str$(i1)
locate 0,8:print a$
b=val(a$)
locate 0,9:printr b
'
if b=5 then print"this is my 5th window":endif
'
DrawText ():
glTranslatef (0, 0, -10)
if b=6 then mx2=mouse_x()*720:my2=mouse_y()*720:
glRotatef (mx2, 0, 1, 0) : glRotatef (my2, 1, 0, 0)
else glRotatef ( i0, 0, 1, 0) : glRotatef ( i1, 1, 0, 0)
endif
'
glEnable (GL_LIGHTING)
glBegin (GL_QUADS)
if b<6 then win.frames = win.frames + 2 :endif
if b>6 then win.frames = win.frames - 2 :endif
'---------------------------------------------------------------------
gln_v3f( 0, 0, 1,-1, -1, 1) ' Draw a lighted cube
gln_v3f( 0, 0, 1, 1, -1, 1)
gln_v3f( 0, 0, 1, 1, 1, 1)
gln_v3f( 0, 0, 1,-1, 1, 1)
'---------------------------------------------------------------------
gln_v3f( 0, 0, -1, 1, 1, -1)
gln_v3f( 0, 0, -1, 1, -1, -1)
gln_v3f( 0, 0, -1,-1, -1, -1)
gln_v3f( 0, 0, -1,-1, 1, -1)
'---------------------------------------------------------------------
gln_v3f( 1, 0, 0, 1, 1, 1)
gln_v3f( 1, 0, 0, 1, -1, 1)
gln_v3f( 1, 0, 0, 1, -1, -1)
gln_v3f( 1, 0, 0, 1, 1, -1)
'---------------------------------------------------------------------
gln_v3f(-1, 0, 0,-1, 1, 1)
gln_v3f(-1, 0, 0,-1, -1, 1)
gln_v3f(-1, 0, 0,-1, -1, -1)
gln_v3f(-1, 0, 0,-1, 1, -1)
'---------------------------------------------------------------------
gln_v3f( 0, 1, 0,-1, 1, -1)
gln_v3f( 0, 1, 0, 1, 1, -1)
gln_v3f( 0, 1, 0, 1, 1, 1)
gln_v3f( 0, 1, 0,-1, 1, 1)
'---------------------------------------------------------------------
gln_v3f(0, -1, 0,-1, -1, -1)
gln_v3f(0, -1, 0, 1, -1, -1)
gln_v3f(0, -1, 0, 1, -1, 1)
gln_v3f(0, -1, 0,-1, -1, 1)
'---------------------------------------------------------------------
glEnd ()
glDisable (GL_LIGHTING)
'
end sub
'
sub gln_v3f(i0,i1,i2,i3,i4,i5): glNormal3f (i0, i1, i2) : glVertex3f (i3, i4, i5) :end sub
'
'v1.01 somewhere found in :basic4gl-demo-programs between pages 1-30
'PCNew, public and combination
'3D window openGL_09.10.fin
'*****************************************************************************************************************************************************************************
'rotate_triangle_02c.04
'
dim a#,z#=-3.5,mx#,my#,mx1#,mx2#,mxd#,myd#
dim c#(3)(3)
dim x#,x0#(10000),x1#,x2#,x3#,x4#
dim xc1,ct,f08,i
dim p1#(2),p2#(2),p3#(2)
dim s,f01,f02,f03,f04
'
c#(0) = vec4 ( -1, 0, 1, 0) 'all value x '0 ,2,-10
c#(1) = vec4 ( -1, 2, -1, 0) 'all value y
c#(2) = vec4 ( -10,-10, -10, 0) 'all value z
c#(3) = vec4 ( 5, 5, 5, 5) '0123 = 4325 'c(3) should move c# vector
'
declare sub triangle() :declare sub keys() :declare sub txt() :declare sub m_xd() :declare sub m_yd()
'
textmode(texT_OVERLAID)
xc1=20:for i=0 to xc1-1:x0#(i)=x#:next
do
glClear (GL_DEPTH_BUFFER_BIT or GL_COLOR_BUFFER_BIT)
glLoadIdentity ()
'glTranslatef (0, 0, 0)
'glRotatef (a#, 0, 0, 1)
'------------------------------------------------------
keys()
if f01 then :c# = c# * MatrixRotateY (mxd#)
else :c# = c# * MatrixRotatex (myd#)
endif
'
m_xd():m_yd()
triangle()
txt()
'------------------------------------------------------
drawtext():SwapBuffers ()
loop
'
sub triangle()
glBegin (GL_TRIANGLES)
p1#=vec3( c#(0,0) ,c#(1,0) ,c#(2,0) ):p2#=vec3( c#(0,1) ,c#(1,1) ,c#(2,1) ):p3#=vec3( c#(0,2) ,c#(1,2) ,c#(2,2) )
glVertex3fv ( p1# ):glVertex3fv ( p2# ):glVertex3fv ( p3# )
glEnd ()
end sub
'
sub keys()
while SyncTimer (5)
if ScanKeyDown (VK_LEFT) then a# = a# + 3: endif
if ScanKeyDown (VK_RIGHT) then a# = a# - 3: endif
if ScanKeyDown (VK_UP) then z#=z#+.2 :c#(2) = vec4 (z# ,z# ,z#, 0):endif
if ScanKeyDown (VK_DOWN) then z#=z#-.2 :c#(2) = vec4 (z# ,z# ,z#, 0):endif
wend
end sub
'
sub m_xd():mxd# = Mouse_XD ()* 50:if mxd#<>0 then f01=true:f02=f02+1: else f01=0:endif :end sub 'x# = x# - mxd#
sub m_yd():if f01=0 then myd# = Mouse_YD ()* 50:if myd#<>0 then f03=true:f04=f04+1: else f03=0:endif :endif:end sub
'sub m_zd():myd# = Mouse_ZD ()* 50:end sub
'
sub txt()
locate 0,0:
printr "mxd#:";mxd#;" "
printr "f01:";f01;" "
printr "f02:";f02;" "
printr "f03:";f03;" "
printr "f04:";f04;" "
end sub
'
'please can anybody explain why the triangle start to circle
'can you correct this demo?
'
'upload improvent into:
www.opendrive.com/
' CHUCK001001@protonmail.com
' 75122300554a
'
'PCN 2.2022
'*****************************************************************************************************************************************************************************
'*****************************************************************************************************************************************************************************
the best ability to fly in 3D is here to be found:3d_space_scr.zip (90.18 KB)
the flyer is based on gluLookAt. Use WASD to fly forward. The basic isn't working, only the exe.
for guests:download with mediafire:
www.mediafire.com/file/uk1dwe2j293z09t/3d_space_scr.zip/file
'*****************************************************************************************************************************************************************************
keys in test_02.exe (112 KB) www.mediafire.com/file/nyo5mr1w7uw01rw/keys_in_test_02.exe/file
Fractal_sponger: 80.03.10a.03.rotate.07.03L4h3.zip
drive.google.com/drive/folders/1dIXj8Saq9uyP_psgVARWFHZbXefbnX2U
( request B4Gl_code: write an email to chuck.summer@mail.com )
'*****************************************************************************************************************************************************************************
3:39 PM 3/6/2020
Lately i found an older 4gl window in the basic4gl-demo-programs between pages 1 and 30 and
we could improve and accomplish v1.0:
'
every window keeps its number
window 1- 5: box turn left
window 7-10: box turn right
window 6 : box turn with mouse_x() and mouse_y()
'*****************************************************************************************************************************************************************************
'4glB-window v1.01 :3D window openGL_09.10.fin
'... somewhere found in :basic4gl-demo-programs between pages 1-30
'PCNew, public and combination
'
declare sub draw_all_windows() :declare sub one_Window(i0,p0,p1,s0,s1) :declare sub draw3D_box(i1,i0) :declare sub draw_border(i0,i1)
declare sub gln_v3f(i0,i1,i2,i3,i4,i5) :declare sub draw_minimize(i0,i1) :declare sub draw_menu_bar(i0,i1) :declare sub draw_if_not_mini(i0,p0,p1,s0,s1)
declare sub w(i0) :declare sub info(i0) :declare sub f01_()
declare sub f11() :declare sub win_minimized(i0)
'*****************************************************************************************************************************************************************
dim LightAmbient#(3): LightAmbient# = vec4 (.5, 1, .5, 1) ' Lighting
dim LightDiffuse#(3): LightDiffuse# = vec4 (.5, 1, .5, 1)
dim LightPosition#(3):LightPosition# = vec4 (0, 10, 20, 1)
'------------------------------------------------------------------------------------------------------------------------------------------------
glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient#) ' light thats always there.
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse#) ' light coming from a source.
glLightfv(GL_LIGHT1, GL_POSITION,LightPosition#) ' where the light source is.
glEnable(GL_LIGHT1) ' enable the light source.
'------------------------------------------------------------------------------------------------------------------------------------------------
dim a$
dim b,c
dim i0,i2,i2#
dim f01,f02,f03
dim i,i7,i8,i9
dim lmb,lmb2
dim md,mx2,my2
dim win_nr(10)
'------------------------------------------------------------------------------------------------------------------------------------------------
struc swindow ' Structure to hold information about the window-
dim frames ' how many times the window has been drawn
dim minimized ' state of the window
dim size#(1) ' x and y size (in pixels)
dim pos# (1) ' x and y position (in pixels, starting at lower left hand corner)
dim normalSize# (1) ' used to store size when minimized
dim mouse# (1) ' position of the mouse cursor on the window
dim nr#
endstruc
'------------------------------------------------------------------------------------------------------------------------------------------------
dim mouse# (1) ' mouse position
dim lastMouse# (1) ' mouse position previous frame
'dim mouseDown (2) ' true if mouse is down
dim lmcl ' true if mouse is clicked
'
dim swindow window (10) ' array of windows
dim swindow &win ' pointer to a window structure- for simplifying code.
'
dim drawArray (10) ' array used to draw windows in order- recently used are drawn last (over the top of previous ones).
dim windowCount ' how many windows there are
dim activeWindow ' which window is currently active
dim ClosestClickedWindow' used to determine if another window was clicked on other than the active window.
'------------------------------------------------------------------------------------------------------------------------------------------------
for i = 0 to 10:window (i).pos# = vec2 (100+i*40,50+i*20):window (i).size# = vec2 (400, 300):drawArray (i) = i:window (i).nr#=i:next:windowCount = i
'
TextMode (TEXT_OVERLAID)
'******************************************************************************************************************************************************************
do
lastMouse# = mouse#
mouse#(0) = Mouse_X () * WindowWidth ()
mouse#(1) =(1-Mouse_Y())*WindowHeight()
lmb = Mouse_Button(0)
'
f11()
'
if lmb then
&win = &window (activeWindow)
if lmb then win.mouse# = mouse# - win.pos# :endif
'
f01_():
if f01 then
if win.Mouse#(1) > win.size#(1)-20 then
if win.Mouse#(0) <= win.size#(0)-20 then win.pos# = win.pos# + mouse#-lastMouse#
else
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
win_minimized(win.minimized)
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
endif
endif
else 'if f01
closestClickedWindow = -1
for i = 0 to windowCount-1
&win = &window (drawArray (i))
win.mouse# = mouse# - win.pos# '-
f01_():if f01 then closestClickedWindow = i :endif
next
'
if not closestClickedWindow = -1 then ActiveWindow = DrawArray (closestClickedWindow)
for i = closestClickedWindow to WindowCount-2 :DrawArray (i) = DrawArray (i+1):next :
DrawArray (WindowCount-1) = ActiveWindow
endif
endif'if f01
win.mouse# = mouse# - win.pos#
endif'if lmb
'
draw_all_windows()
loop
sub win_minimized(i0)
if lmcl then f03=true
if i0=0 then
win.normalSize# = win.size#
win.size#(0) = 150
win.size#(1) = 20
win.pos# = win.pos# - win.size# + win.normalsize#
win.minimized = true
endif
if i0 =true then
win.pos# = win.pos# + win.size# - win.normalSize#
win.size# = win.normalSize#
win.minimized = false
endif
endif
end sub
'*********************************************************************************************************************************************
sub f11()
if f02=0 and lmb then lmcl = true:f02=true:endif
if f02 and f03 then lmcl=0 :endif
if f02 and not lmb then f03=0:f02=0 :endif
end sub
'*********************************************************************************************************************************************
sub f01_():f01 = win.mouse#(0)>=0 and win.mouse#(1)>=0 and win.mouse#(0)<=win.size#(0) and win.mouse#(1)<=win.size#(1):end sub
sub draw_all_windows()
glClearColor (0, 0, 0, 0)
glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
glEnable (GL_SCISSOR_TEST)
for i = 0 to windowCount-1 : w(i):one_Window(i2,win.pos#(0),win.pos#(1),win.size#(0),win.size#(1)) :: next
glDisable (GL_SCISSOR_TEST)
SwapBuffers ()
end sub
sub w(i0):&win = &window (drawArray (i0)):i2=win.nr#:end sub
'
sub one_Window(i0,p0,p1,s0,s1): info(1)
'
glLoadIdentity () :glScissor (p0, p1, s0, s1) :glViewport (p0, p1, s0, s1)
glClearColor (.5, .5, .5, 1):glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT) ' Clear out all previous information from the scissor rectangle.
'
glMatrixMode (GL_PROJECTION)
glLoadIdentity ()
glOrtho (0, s0, 0, s1, -1, 1) ' Set 2D mode
glMatrixMode (GL_MODELVIEW)
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
draw_menu_bar( win.size#(0),win.size#(1) )
draw_minimize( win.size#(0),win.size#(1) ) ' Minimize button
draw_border( win.size#(0),win.size#(1) )
draw_if_not_mini(i0,win.pos#(0),win.pos#(1),win.size#(0),win.size#(1))
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
end sub
sub info(i0):if i0=1 then
' Only draw a rectangle the size of the window. This is done
' by using glScissor, which makes it so only the scissored
' part of the screen is drawn to. Also reset the viewport so
' the coordinates behave the same way they would if they were
' drawn in a normal opengl window.
endif:end sub
'
sub draw_if_not_mini(i0,p0,p1,s0,s1)' Draw what's inside the window if it's not minimized.
if not win.minimized then
glScissor (p0+2,p1+2, s0-4, s1-22) ' Clip the draw area to within the window border- two units on each
glViewPort (p0+2,p1+2, s0-4, s1-22) ' side, 2 units on the bottom and 20 units for the top.
'
glclearColor (.1, .1, .1, .1)
glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT)
'
glMatrixMode (GL_PROJECTION) ' Set 3D mode
glLoadIdentity ()
gluPerspective (60, (1.0*s0)/s1, 1, 1000)
glMatrixMode (GL_MODELVIEW)
'
draw3D_box(i0,win.frames)
endif
end sub
'
sub draw_menu_bar(i0,i1)
if drawArray (i) = ActiveWindow then
glBegin (GL_QUADS)
glColor3f (0, 0, .5) : glVertex2f ( 0, i1-20)
glColor3f (0, .1, .5) : glVertex2f (i0, i1-20)
glColor3f (0, .5, .2) : glVertex2f (i0, i1)
glColor3f (0, .2, .2) : glVertex2f ( 0, i1)
glEnd ()
else
glBegin (GL_QUADS)
glColor3f (.1, 0, .1) : glVertex2f ( 0, i1-20)
glColor3f (.1, .1, .1) : glVertex2f (i0, i1-20)
glColor3f (.1, .1, .2) : glVertex2f (i0, i1)
glColor3f (.1, .2, .2) : glVertex2f ( 0, i1)
glEnd ()
endif
end sub
'
sub draw_minimize(i0,i1)
glBegin (GL_QUADS)
glColor3f (.5, .5, .5): glVertex2f (i0 -18, i1 - 18)
glColor3f (.3, .3, .3): glvertex2f (i0 - 2, i1 - 18)
glColor3f (.5, .5, .5): glVertex2f (i0 - 2, i1 - 2)
glColor3f (.3, .3, .3): glVertex2f (i0 -18, i1 - 2)
glEnd ()
end sub
'
sub draw_border(i0,i1)
glBegin (GL_QUADS) :glColor3f (0, 0, .5)
glVertex2f (0, 0) :glVertex2f (2, 0)
glVertex2f (2, i1 - 20) :glVertex2f (0, i1 - 20)
glVertex2f (2, 0) :glVertex2f (i0-2, 0)
glVertex2f (i0-2, 2) :glVertex2f (2, 2)
glVertex2f (i0 -2, 0) :glVertex2f (i0 -2, i1 - 20)
glVertex2f (i0,i1 - 20) :glVertex2f (i0 , 0 )
glEnd ()
end sub
'
sub draw3D_box(i1,i0):
ResizeText (25, 15) :printr "3D OpenGL Windows:";i1;" "
locate 0,2:print "lmc:";lmcl
locate 0,3:print "md:" ;
locate 0,4:print "lmb:";lmb
locate 0,5:print "i8:" ;i8
locate 0,6:print "i9:" ;i9
locate 0,7:print "i1:" ;i1:a$=str$(i1)
locate 0,8:print a$
b=val(a$)
locate 0,9:printr b
'
if b=5 then print"this is my 5th window":endif
'
DrawText ():
glTranslatef (0, 0, -10)
if b=6 then mx2=mouse_x()*720:my2=mouse_y()*720:
glRotatef (mx2, 0, 1, 0) : glRotatef (my2, 1, 0, 0)
else glRotatef ( i0, 0, 1, 0) : glRotatef ( i1, 1, 0, 0)
endif
'
glEnable (GL_LIGHTING)
glBegin (GL_QUADS)
if b<6 then win.frames = win.frames + 2 :endif
if b>6 then win.frames = win.frames - 2 :endif
'---------------------------------------------------------------------
gln_v3f( 0, 0, 1,-1, -1, 1) ' Draw a lighted cube
gln_v3f( 0, 0, 1, 1, -1, 1)
gln_v3f( 0, 0, 1, 1, 1, 1)
gln_v3f( 0, 0, 1,-1, 1, 1)
'---------------------------------------------------------------------
gln_v3f( 0, 0, -1, 1, 1, -1)
gln_v3f( 0, 0, -1, 1, -1, -1)
gln_v3f( 0, 0, -1,-1, -1, -1)
gln_v3f( 0, 0, -1,-1, 1, -1)
'---------------------------------------------------------------------
gln_v3f( 1, 0, 0, 1, 1, 1)
gln_v3f( 1, 0, 0, 1, -1, 1)
gln_v3f( 1, 0, 0, 1, -1, -1)
gln_v3f( 1, 0, 0, 1, 1, -1)
'---------------------------------------------------------------------
gln_v3f(-1, 0, 0,-1, 1, 1)
gln_v3f(-1, 0, 0,-1, -1, 1)
gln_v3f(-1, 0, 0,-1, -1, -1)
gln_v3f(-1, 0, 0,-1, 1, -1)
'---------------------------------------------------------------------
gln_v3f( 0, 1, 0,-1, 1, -1)
gln_v3f( 0, 1, 0, 1, 1, -1)
gln_v3f( 0, 1, 0, 1, 1, 1)
gln_v3f( 0, 1, 0,-1, 1, 1)
'---------------------------------------------------------------------
gln_v3f(0, -1, 0,-1, -1, -1)
gln_v3f(0, -1, 0, 1, -1, -1)
gln_v3f(0, -1, 0, 1, -1, 1)
gln_v3f(0, -1, 0,-1, -1, 1)
'---------------------------------------------------------------------
glEnd ()
glDisable (GL_LIGHTING)
'
end sub
'
sub gln_v3f(i0,i1,i2,i3,i4,i5): glNormal3f (i0, i1, i2) : glVertex3f (i3, i4, i5) :end sub
'
'v1.01 somewhere found in :basic4gl-demo-programs between pages 1-30
'PCNew, public and combination
'3D window openGL_09.10.fin
'*****************************************************************************************************************************************************************************



'rotate_triangle_02c.04
'
dim a#,z#=-3.5,mx#,my#,mx1#,mx2#,mxd#,myd#
dim c#(3)(3)
dim x#,x0#(10000),x1#,x2#,x3#,x4#
dim xc1,ct,f08,i
dim p1#(2),p2#(2),p3#(2)
dim s,f01,f02,f03,f04
'
c#(0) = vec4 ( -1, 0, 1, 0) 'all value x '0 ,2,-10
c#(1) = vec4 ( -1, 2, -1, 0) 'all value y
c#(2) = vec4 ( -10,-10, -10, 0) 'all value z
c#(3) = vec4 ( 5, 5, 5, 5) '0123 = 4325 'c(3) should move c# vector
'
declare sub triangle() :declare sub keys() :declare sub txt() :declare sub m_xd() :declare sub m_yd()
'
textmode(texT_OVERLAID)
xc1=20:for i=0 to xc1-1:x0#(i)=x#:next
do
glClear (GL_DEPTH_BUFFER_BIT or GL_COLOR_BUFFER_BIT)
glLoadIdentity ()
'glTranslatef (0, 0, 0)
'glRotatef (a#, 0, 0, 1)
'------------------------------------------------------
keys()
if f01 then :c# = c# * MatrixRotateY (mxd#)
else :c# = c# * MatrixRotatex (myd#)
endif
'
m_xd():m_yd()
triangle()
txt()
'------------------------------------------------------
drawtext():SwapBuffers ()
loop
'
sub triangle()
glBegin (GL_TRIANGLES)
p1#=vec3( c#(0,0) ,c#(1,0) ,c#(2,0) ):p2#=vec3( c#(0,1) ,c#(1,1) ,c#(2,1) ):p3#=vec3( c#(0,2) ,c#(1,2) ,c#(2,2) )
glVertex3fv ( p1# ):glVertex3fv ( p2# ):glVertex3fv ( p3# )
glEnd ()
end sub
'
sub keys()
while SyncTimer (5)
if ScanKeyDown (VK_LEFT) then a# = a# + 3: endif
if ScanKeyDown (VK_RIGHT) then a# = a# - 3: endif
if ScanKeyDown (VK_UP) then z#=z#+.2 :c#(2) = vec4 (z# ,z# ,z#, 0):endif
if ScanKeyDown (VK_DOWN) then z#=z#-.2 :c#(2) = vec4 (z# ,z# ,z#, 0):endif
wend
end sub
'
sub m_xd():mxd# = Mouse_XD ()* 50:if mxd#<>0 then f01=true:f02=f02+1: else f01=0:endif :end sub 'x# = x# - mxd#
sub m_yd():if f01=0 then myd# = Mouse_YD ()* 50:if myd#<>0 then f03=true:f04=f04+1: else f03=0:endif :endif:end sub
'sub m_zd():myd# = Mouse_ZD ()* 50:end sub
'
sub txt()
locate 0,0:
printr "mxd#:";mxd#;" "
printr "f01:";f01;" "
printr "f02:";f02;" "
printr "f03:";f03;" "
printr "f04:";f04;" "
end sub
'
'please can anybody explain why the triangle start to circle
'can you correct this demo?
'
'upload improvent into:
www.opendrive.com/
' CHUCK001001@protonmail.com
' 75122300554a
'
'PCN 2.2022
'*****************************************************************************************************************************************************************************
