nehe: fix load errors
parent
db5998e121
commit
c80e5435d4
|
@ -1,5 +1,6 @@
|
|||
USING: arrays kernel math opengl opengl.gl opengl.glu
|
||||
opengl.demo-support ui ui.gadgets ui.render literals accessors ;
|
||||
opengl.demo-support ui ui.gadgets ui.render ui.pixel-formats
|
||||
literals accessors ;
|
||||
IN: nehe.2
|
||||
|
||||
TUPLE: nehe2-gadget < gadget ;
|
||||
|
@ -8,36 +9,36 @@ CONSTANT: width 256
|
|||
CONSTANT: height 256
|
||||
|
||||
: <nehe2-gadget> ( -- gadget )
|
||||
nehe2-gadget new ;
|
||||
nehe2-gadget new ;
|
||||
|
||||
M: nehe2-gadget draw-gadget* ( gadget -- )
|
||||
drop
|
||||
GL_PROJECTION glMatrixMode
|
||||
glLoadIdentity
|
||||
45.0 width height / >float 0.1 100.0 gluPerspective
|
||||
GL_MODELVIEW glMatrixMode
|
||||
glLoadIdentity
|
||||
GL_SMOOTH glShadeModel
|
||||
0.0 0.0 0.0 0.0 glClearColor
|
||||
1.0 glClearDepth
|
||||
GL_DEPTH_TEST glEnable
|
||||
GL_LEQUAL glDepthFunc
|
||||
GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
|
||||
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
|
||||
glLoadIdentity
|
||||
-1.5 0.0 -6.0 glTranslatef
|
||||
GL_TRIANGLES [
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
-1.0 -1.0 0.0 glVertex3f
|
||||
1.0 -1.0 0.0 glVertex3f
|
||||
] do-state
|
||||
3.0 0.0 0.0 glTranslatef
|
||||
GL_QUADS [
|
||||
-1.0 1.0 0.0 glVertex3f
|
||||
1.0 1.0 0.0 glVertex3f
|
||||
1.0 -1.0 0.0 glVertex3f
|
||||
-1.0 -1.0 0.0 glVertex3f
|
||||
] do-state ;
|
||||
drop
|
||||
GL_PROJECTION glMatrixMode
|
||||
glLoadIdentity
|
||||
45.0 width height / >float 0.1 100.0 gluPerspective
|
||||
GL_MODELVIEW glMatrixMode
|
||||
glLoadIdentity
|
||||
GL_SMOOTH glShadeModel
|
||||
0.0 0.0 0.0 0.0 glClearColor
|
||||
1.0 glClearDepth
|
||||
GL_DEPTH_TEST glEnable
|
||||
GL_LEQUAL glDepthFunc
|
||||
GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
|
||||
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
|
||||
glLoadIdentity
|
||||
-1.5 0.0 -6.0 glTranslatef
|
||||
GL_TRIANGLES [
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
-1.0 -1.0 0.0 glVertex3f
|
||||
1.0 -1.0 0.0 glVertex3f
|
||||
] do-state
|
||||
3.0 0.0 0.0 glTranslatef
|
||||
GL_QUADS [
|
||||
-1.0 1.0 0.0 glVertex3f
|
||||
1.0 1.0 0.0 glVertex3f
|
||||
1.0 -1.0 0.0 glVertex3f
|
||||
-1.0 -1.0 0.0 glVertex3f
|
||||
] do-state ;
|
||||
|
||||
MAIN-WINDOW: run2
|
||||
{
|
||||
|
@ -49,4 +50,4 @@ MAIN-WINDOW: run2
|
|||
T{ depth-bits { value 16 } }
|
||||
} }
|
||||
}
|
||||
<nehe2-gadget> >>gadgets ;
|
||||
<nehe2-gadget> >>gadgets ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
USING: arrays kernel math opengl opengl.gl opengl.glu
|
||||
opengl.demo-support ui ui.gadgets ui.render threads accessors
|
||||
calendar literals ;
|
||||
opengl.demo-support ui ui.gadgets ui.render ui.pixel-formats
|
||||
threads accessors calendar literals ;
|
||||
IN: nehe.4
|
||||
|
||||
TUPLE: nehe4-gadget < gadget rtri rquad thread quit? ;
|
||||
|
@ -10,63 +10,63 @@ CONSTANT: height 256
|
|||
: redraw-interval ( -- dt ) 10 milliseconds ;
|
||||
|
||||
: <nehe4-gadget> ( -- gadget )
|
||||
nehe4-gadget new
|
||||
nehe4-gadget new
|
||||
0.0 >>rtri
|
||||
0.0 >>rquad ;
|
||||
|
||||
M: nehe4-gadget draw-gadget* ( gadget -- )
|
||||
GL_PROJECTION glMatrixMode
|
||||
glLoadIdentity
|
||||
45.0 width height / >float 0.1 100.0 gluPerspective
|
||||
GL_MODELVIEW glMatrixMode
|
||||
glLoadIdentity
|
||||
GL_SMOOTH glShadeModel
|
||||
0.0 0.0 0.0 0.0 glClearColor
|
||||
1.0 glClearDepth
|
||||
GL_DEPTH_TEST glEnable
|
||||
GL_LEQUAL glDepthFunc
|
||||
GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
|
||||
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
|
||||
glLoadIdentity
|
||||
-1.5 0.0 -6.0 glTranslatef
|
||||
dup rtri>> 0.0 1.0 0.0 glRotatef
|
||||
GL_PROJECTION glMatrixMode
|
||||
glLoadIdentity
|
||||
45.0 width height / >float 0.1 100.0 gluPerspective
|
||||
GL_MODELVIEW glMatrixMode
|
||||
glLoadIdentity
|
||||
GL_SMOOTH glShadeModel
|
||||
0.0 0.0 0.0 0.0 glClearColor
|
||||
1.0 glClearDepth
|
||||
GL_DEPTH_TEST glEnable
|
||||
GL_LEQUAL glDepthFunc
|
||||
GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
|
||||
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
|
||||
glLoadIdentity
|
||||
-1.5 0.0 -6.0 glTranslatef
|
||||
dup rtri>> 0.0 1.0 0.0 glRotatef
|
||||
|
||||
GL_TRIANGLES [
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
-1.0 -1.0 0.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
1.0 -1.0 0.0 glVertex3f
|
||||
] do-state
|
||||
GL_TRIANGLES [
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
-1.0 -1.0 0.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
1.0 -1.0 0.0 glVertex3f
|
||||
] do-state
|
||||
|
||||
glLoadIdentity
|
||||
glLoadIdentity
|
||||
|
||||
1.5 0.0 -6.0 glTranslatef
|
||||
dup rquad>> 1.0 0.0 0.0 glRotatef
|
||||
0.5 0.5 1.0 glColor3f
|
||||
GL_QUADS [
|
||||
-1.0 1.0 0.0 glVertex3f
|
||||
1.0 1.0 0.0 glVertex3f
|
||||
1.0 -1.0 0.0 glVertex3f
|
||||
-1.0 -1.0 0.0 glVertex3f
|
||||
] do-state
|
||||
[ 0.2 + ] change-rtri
|
||||
[ 0.15 - ] change-rquad drop ;
|
||||
1.5 0.0 -6.0 glTranslatef
|
||||
dup rquad>> 1.0 0.0 0.0 glRotatef
|
||||
0.5 0.5 1.0 glColor3f
|
||||
GL_QUADS [
|
||||
-1.0 1.0 0.0 glVertex3f
|
||||
1.0 1.0 0.0 glVertex3f
|
||||
1.0 -1.0 0.0 glVertex3f
|
||||
-1.0 -1.0 0.0 glVertex3f
|
||||
] do-state
|
||||
[ 0.2 + ] change-rtri
|
||||
[ 0.15 - ] change-rquad drop ;
|
||||
|
||||
: nehe4-update-thread ( gadget -- )
|
||||
dup quit?>> [ drop ] [
|
||||
redraw-interval sleep
|
||||
dup relayout-1
|
||||
nehe4-update-thread
|
||||
] if ;
|
||||
dup quit?>> [ drop ] [
|
||||
redraw-interval sleep
|
||||
dup relayout-1
|
||||
nehe4-update-thread
|
||||
] if ;
|
||||
|
||||
M: nehe4-gadget graft* ( gadget -- )
|
||||
f >>quit?
|
||||
[ nehe4-update-thread ] curry in-thread ;
|
||||
f >>quit?
|
||||
[ nehe4-update-thread ] curry in-thread ;
|
||||
|
||||
M: nehe4-gadget ungraft* ( gadget -- )
|
||||
t >>quit? drop ;
|
||||
t >>quit? drop ;
|
||||
|
||||
MAIN-WINDOW: run4
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
USING: arrays kernel math opengl opengl.gl opengl.glu
|
||||
opengl.demo-support ui ui.gadgets ui.render threads accessors
|
||||
calendar literals ;
|
||||
opengl.demo-support ui ui.gadgets ui.render ui.pixel-formats
|
||||
threads accessors calendar literals ;
|
||||
IN: nehe.5
|
||||
|
||||
TUPLE: nehe5-gadget < gadget rtri rquad thread quit? ;
|
||||
|
@ -9,118 +9,118 @@ CONSTANT: height 256
|
|||
: redraw-interval ( -- dt ) 10 milliseconds ;
|
||||
|
||||
: <nehe5-gadget> ( -- gadget )
|
||||
nehe5-gadget new
|
||||
nehe5-gadget new
|
||||
0.0 >>rtri
|
||||
0.0 >>rquad ;
|
||||
|
||||
M: nehe5-gadget draw-gadget* ( gadget -- )
|
||||
GL_PROJECTION glMatrixMode
|
||||
glLoadIdentity
|
||||
45.0 width height / >float 0.1 100.0 gluPerspective
|
||||
GL_MODELVIEW glMatrixMode
|
||||
glLoadIdentity
|
||||
GL_SMOOTH glShadeModel
|
||||
0.0 0.0 0.0 0.0 glClearColor
|
||||
1.0 glClearDepth
|
||||
GL_DEPTH_TEST glEnable
|
||||
GL_LEQUAL glDepthFunc
|
||||
GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
|
||||
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
|
||||
glLoadIdentity
|
||||
-1.5 0.0 -6.0 glTranslatef
|
||||
dup rtri>> 0.0 1.0 0.0 glRotatef
|
||||
GL_PROJECTION glMatrixMode
|
||||
glLoadIdentity
|
||||
45.0 width height / >float 0.1 100.0 gluPerspective
|
||||
GL_MODELVIEW glMatrixMode
|
||||
glLoadIdentity
|
||||
GL_SMOOTH glShadeModel
|
||||
0.0 0.0 0.0 0.0 glClearColor
|
||||
1.0 glClearDepth
|
||||
GL_DEPTH_TEST glEnable
|
||||
GL_LEQUAL glDepthFunc
|
||||
GL_PERSPECTIVE_CORRECTION_HINT GL_NICEST glHint
|
||||
GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
|
||||
glLoadIdentity
|
||||
-1.5 0.0 -6.0 glTranslatef
|
||||
dup rtri>> 0.0 1.0 0.0 glRotatef
|
||||
|
||||
GL_TRIANGLES [
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
GL_TRIANGLES [
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
] do-state
|
||||
1.0 0.0 0.0 glColor3f
|
||||
0.0 1.0 0.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
0.0 1.0 0.0 glColor3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
] do-state
|
||||
|
||||
glLoadIdentity
|
||||
glLoadIdentity
|
||||
|
||||
1.5 0.0 -7.0 glTranslatef
|
||||
dup rquad>> 1.0 0.0 0.0 glRotatef
|
||||
GL_QUADS [
|
||||
0.0 1.0 0.0 glColor3f
|
||||
1.0 1.0 -1.0 glVertex3f
|
||||
-1.0 1.0 -1.0 glVertex3f
|
||||
-1.0 1.0 1.0 glVertex3f
|
||||
1.0 1.0 1.0 glVertex3f
|
||||
1.5 0.0 -7.0 glTranslatef
|
||||
dup rquad>> 1.0 0.0 0.0 glRotatef
|
||||
GL_QUADS [
|
||||
0.0 1.0 0.0 glColor3f
|
||||
1.0 1.0 -1.0 glVertex3f
|
||||
-1.0 1.0 -1.0 glVertex3f
|
||||
-1.0 1.0 1.0 glVertex3f
|
||||
1.0 1.0 1.0 glVertex3f
|
||||
|
||||
1.0 0.5 0.0 glColor3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
1.0 0.5 0.0 glColor3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
|
||||
1.0 0.0 0.0 glColor3f
|
||||
1.0 1.0 1.0 glVertex3f
|
||||
-1.0 1.0 1.0 glVertex3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
1.0 0.0 0.0 glColor3f
|
||||
1.0 1.0 1.0 glVertex3f
|
||||
-1.0 1.0 1.0 glVertex3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
|
||||
1.0 1.0 0.0 glColor3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
-1.0 1.0 -1.0 glVertex3f
|
||||
1.0 1.0 -1.0 glVertex3f
|
||||
1.0 1.0 0.0 glColor3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
-1.0 1.0 -1.0 glVertex3f
|
||||
1.0 1.0 -1.0 glVertex3f
|
||||
|
||||
0.0 0.0 1.0 glColor3f
|
||||
-1.0 1.0 1.0 glVertex3f
|
||||
-1.0 1.0 -1.0 glVertex3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
0.0 0.0 1.0 glColor3f
|
||||
-1.0 1.0 1.0 glVertex3f
|
||||
-1.0 1.0 -1.0 glVertex3f
|
||||
-1.0 -1.0 -1.0 glVertex3f
|
||||
-1.0 -1.0 1.0 glVertex3f
|
||||
|
||||
1.0 0.0 1.0 glColor3f
|
||||
1.0 1.0 -1.0 glVertex3f
|
||||
1.0 1.0 1.0 glVertex3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
] do-state
|
||||
[ 0.2 + ] change-rtri
|
||||
[ 0.15 - ] change-rquad drop ;
|
||||
1.0 0.0 1.0 glColor3f
|
||||
1.0 1.0 -1.0 glVertex3f
|
||||
1.0 1.0 1.0 glVertex3f
|
||||
1.0 -1.0 1.0 glVertex3f
|
||||
1.0 -1.0 -1.0 glVertex3f
|
||||
] do-state
|
||||
[ 0.2 + ] change-rtri
|
||||
[ 0.15 - ] change-rquad drop ;
|
||||
|
||||
: nehe5-update-thread ( gadget -- )
|
||||
dup quit?>> [
|
||||
drop
|
||||
] [
|
||||
redraw-interval sleep
|
||||
dup relayout-1
|
||||
nehe5-update-thread
|
||||
] if ;
|
||||
: nehe5-update-thread ( gadget -- )
|
||||
dup quit?>> [
|
||||
drop
|
||||
] [
|
||||
redraw-interval sleep
|
||||
dup relayout-1
|
||||
nehe5-update-thread
|
||||
] if ;
|
||||
|
||||
M: nehe5-gadget graft* ( gadget -- )
|
||||
f >>quit?
|
||||
[ nehe5-update-thread ] curry in-thread ;
|
||||
f >>quit?
|
||||
[ nehe5-update-thread ] curry in-thread ;
|
||||
|
||||
M: nehe5-gadget ungraft* ( gadget -- )
|
||||
t >>quit? drop ;
|
||||
t >>quit? drop ;
|
||||
|
||||
MAIN-WINDOW: run4
|
||||
MAIN-WINDOW: run5
|
||||
{
|
||||
{ title "NeHe Tutorial 5" }
|
||||
{ pref-dim { $ width $ height } }
|
||||
|
|
Loading…
Reference in New Issue