Updating various apps in extra for GL words being moved around
parent
66558ce584
commit
18df06fde1
|
@ -30,7 +30,7 @@ IN: automata.ui
|
||||||
|
|
||||||
: draw-bitmap ( bitmap -- ) GL_POINTS glBegin (draw-bitmap) glEnd ;
|
: draw-bitmap ( bitmap -- ) GL_POINTS glBegin (draw-bitmap) glEnd ;
|
||||||
|
|
||||||
: display ( -- ) black set-color bitmap> draw-bitmap ;
|
: display ( -- ) black gl-color bitmap> draw-bitmap ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
USING: accessors alien.c-types arrays combinators destructors http.client
|
USING: accessors alien.c-types arrays combinators destructors
|
||||||
io io.encodings.ascii io.files kernel math math.matrices math.parser
|
http.client io io.encodings.ascii io.files kernel math
|
||||||
math.vectors opengl opengl.capabilities opengl.gl sequences sequences.lib
|
math.matrices math.parser math.vectors opengl
|
||||||
splitting vectors words ;
|
opengl.capabilities opengl.gl opengl.demo-support sequences
|
||||||
|
sequences.lib splitting vectors words ;
|
||||||
IN: bunny.model
|
IN: bunny.model
|
||||||
|
|
||||||
: numbers ( str -- seq )
|
: numbers ( str -- seq )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: arrays bunny.model bunny.cel-shaded continuations
|
USING: arrays bunny.model bunny.cel-shaded continuations
|
||||||
destructors kernel math multiline opengl opengl.shaders
|
destructors kernel math multiline opengl opengl.shaders
|
||||||
opengl.framebuffers opengl.gl opengl.capabilities sequences
|
opengl.framebuffers opengl.gl opengl.demo-support
|
||||||
ui.gadgets combinators accessors ;
|
opengl.capabilities sequences ui.gadgets combinators accessors ;
|
||||||
IN: bunny.outlined
|
IN: bunny.outlined
|
||||||
|
|
||||||
STRING: outlined-pass1-fragment-shader-main-source
|
STRING: outlined-pass1-fragment-shader-main-source
|
||||||
|
|
|
@ -14,7 +14,7 @@ IN: cfdg
|
||||||
|
|
||||||
SELF-SLOTS: hsva
|
SELF-SLOTS: hsva
|
||||||
|
|
||||||
: clear-color ( color -- ) set-clear-color GL_COLOR_BUFFER_BIT glClear ;
|
: clear-color ( color -- ) gl-clear-color GL_COLOR_BUFFER_BIT glClear ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ VAR: color-stack
|
||||||
|
|
||||||
: push-color ( -- ) self> color-stack> push self> clone >self ;
|
: push-color ( -- ) self> color-stack> push self> clone >self ;
|
||||||
|
|
||||||
: pop-color ( -- ) color-stack> pop dup >self set-color ;
|
: pop-color ( -- ) color-stack> pop dup >self gl-color ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
@ -80,11 +80,11 @@ VAR: threshold
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: circle ( -- )
|
: circle ( -- )
|
||||||
self> set-color
|
self> gl-color
|
||||||
gluNewQuadric dup 0 0.5 20 10 gluDisk gluDeleteQuadric ;
|
gluNewQuadric dup 0 0.5 20 10 gluDisk gluDeleteQuadric ;
|
||||||
|
|
||||||
: triangle ( -- )
|
: triangle ( -- )
|
||||||
self> set-color
|
self> gl-color
|
||||||
GL_POLYGON glBegin
|
GL_POLYGON glBegin
|
||||||
0 0.577 glVertex2d
|
0 0.577 glVertex2d
|
||||||
0.5 -0.289 glVertex2d
|
0.5 -0.289 glVertex2d
|
||||||
|
@ -92,7 +92,7 @@ VAR: threshold
|
||||||
glEnd ;
|
glEnd ;
|
||||||
|
|
||||||
: square ( -- )
|
: square ( -- )
|
||||||
self> set-color
|
self> gl-color
|
||||||
GL_POLYGON glBegin
|
GL_POLYGON glBegin
|
||||||
-0.5 0.5 glVertex2d
|
-0.5 0.5 glVertex2d
|
||||||
0.5 0.5 glVertex2d
|
0.5 0.5 glVertex2d
|
||||||
|
@ -192,7 +192,7 @@ SYMBOL: dlist
|
||||||
|
|
||||||
set-initial-color
|
set-initial-color
|
||||||
|
|
||||||
self> set-color
|
self> gl-color
|
||||||
|
|
||||||
start-shape> call
|
start-shape> call
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
! Copyright (C) 2007, 2008 Alex Chapman
|
! Copyright (C) 2007, 2008 Alex Chapman
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors alien.c-types jamshred.game jamshred.oint jamshred.player jamshred.tunnel kernel math math.constants math.functions math.vectors opengl opengl.gl opengl.glu sequences float-arrays ;
|
USING: accessors alien.c-types jamshred.game jamshred.oint
|
||||||
|
jamshred.player jamshred.tunnel kernel math math.constants
|
||||||
|
math.functions math.vectors opengl opengl.gl opengl.glu
|
||||||
|
opengl.demo-support sequences float-arrays ;
|
||||||
IN: jamshred.gl
|
IN: jamshred.gl
|
||||||
|
|
||||||
: min-vertices 6 ; inline
|
: min-vertices 6 ; inline
|
||||||
|
@ -43,7 +46,7 @@ IN: jamshred.gl
|
||||||
dup [ / pi 2 * * ] curry map ;
|
dup [ / pi 2 * * ] curry map ;
|
||||||
|
|
||||||
: draw-segment-vertex ( segment theta -- )
|
: draw-segment-vertex ( segment theta -- )
|
||||||
over color>> set-color segment-vertex-and-normal
|
over color>> gl-color segment-vertex-and-normal
|
||||||
gl-normal gl-vertex ;
|
gl-normal gl-vertex ;
|
||||||
|
|
||||||
: draw-vertex-pair ( theta next-segment segment -- )
|
: draw-vertex-pair ( theta next-segment segment -- )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! From http://www.ffconsultancy.com/ocaml/maze/index.html
|
! From http://www.ffconsultancy.com/ocaml/maze/index.html
|
||||||
USING: sequences namespaces math math.vectors opengl opengl.gl
|
USING: sequences namespaces math math.vectors opengl opengl.gl
|
||||||
arrays kernel random ui ui.gadgets ui.gadgets.canvas ui.render
|
opengl.demo-support arrays kernel random ui ui.gadgets
|
||||||
math.order math.geometry.rect ;
|
ui.gadgets.canvas ui.render math.order math.geometry.rect ;
|
||||||
IN: maze
|
IN: maze
|
||||||
|
|
||||||
: line-width 8 ;
|
: line-width 8 ;
|
||||||
|
@ -41,6 +41,7 @@ SYMBOL: visited
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: draw-maze ( n -- )
|
: draw-maze ( n -- )
|
||||||
|
-0.5 0.5 0 glTranslated
|
||||||
line-width 2 - glLineWidth
|
line-width 2 - glLineWidth
|
||||||
line-width 2 - glPointSize
|
line-width 2 - glPointSize
|
||||||
1.0 1.0 1.0 1.0 glColor4d
|
1.0 1.0 1.0 1.0 glColor4d
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: arrays kernel math opengl opengl.gl opengl.glu ui
|
USING: arrays kernel math opengl opengl.gl opengl.glu
|
||||||
ui.gadgets ui.render ;
|
opengl.demo-support ui ui.gadgets ui.render ;
|
||||||
IN: nehe.2
|
IN: nehe.2
|
||||||
|
|
||||||
TUPLE: nehe2-gadget < gadget ;
|
TUPLE: nehe2-gadget < gadget ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: arrays kernel math opengl opengl.gl opengl.glu ui
|
USING: arrays kernel math opengl opengl.gl opengl.glu
|
||||||
ui.gadgets ui.render ;
|
opengl.demo-support ui ui.gadgets ui.render ;
|
||||||
IN: nehe.3
|
IN: nehe.3
|
||||||
|
|
||||||
TUPLE: nehe3-gadget < gadget ;
|
TUPLE: nehe3-gadget < gadget ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: arrays kernel math opengl opengl.gl opengl.glu ui
|
USING: arrays kernel math opengl opengl.gl opengl.glu
|
||||||
ui.gadgets ui.render threads accessors ;
|
opengl.demo-support ui ui.gadgets ui.render threads accessors ;
|
||||||
IN: nehe.4
|
IN: nehe.4
|
||||||
|
|
||||||
TUPLE: nehe4-gadget < gadget rtri rquad thread quit? ;
|
TUPLE: nehe4-gadget < gadget rtri rquad thread quit? ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: arrays kernel math opengl opengl.gl opengl.glu ui
|
USING: arrays kernel math opengl opengl.gl opengl.glu
|
||||||
ui.gadgets ui.render threads accessors ;
|
opengl.demo-support ui ui.gadgets ui.render threads accessors ;
|
||||||
IN: nehe.5
|
IN: nehe.5
|
||||||
|
|
||||||
TUPLE: nehe5-gadget < gadget rtri rquad thread quit? ;
|
TUPLE: nehe5-gadget < gadget rtri rquad thread quit? ;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
USING: arrays kernel math math.functions
|
USING: arrays kernel math math.functions math.order math.vectors
|
||||||
math.order math.vectors namespaces opengl opengl.gl sequences ui
|
namespaces opengl opengl.gl sequences ui ui.gadgets ui.gestures
|
||||||
ui.gadgets ui.gestures ui.render accessors ;
|
ui.render accessors combinators ;
|
||||||
IN: opengl.demo-support
|
IN: opengl.demo-support
|
||||||
|
|
||||||
: FOV 2.0 sqrt 1+ ; inline
|
: FOV 2.0 sqrt 1+ ; inline
|
||||||
|
@ -74,6 +74,26 @@ M: demo-gadget pref-dim* ( gadget -- dim )
|
||||||
: drag-yaw-pitch ( -- yaw pitch )
|
: drag-yaw-pitch ( -- yaw pitch )
|
||||||
last-drag-rel MOUSE-MOTION-SCALE v*n first2 ;
|
last-drag-rel MOUSE-MOTION-SCALE v*n first2 ;
|
||||||
|
|
||||||
|
: gl-vertex ( point -- )
|
||||||
|
dup length {
|
||||||
|
{ 2 [ first2 glVertex2d ] }
|
||||||
|
{ 3 [ first3 glVertex3d ] }
|
||||||
|
{ 4 [ first4 glVertex4d ] }
|
||||||
|
} case ;
|
||||||
|
|
||||||
|
: gl-normal ( normal -- ) first3 glNormal3d ;
|
||||||
|
|
||||||
|
: do-state ( mode quot -- )
|
||||||
|
swap glBegin call glEnd ; inline
|
||||||
|
|
||||||
|
: rect-vertices ( lower-left upper-right -- )
|
||||||
|
GL_QUADS [
|
||||||
|
over first2 glVertex2d
|
||||||
|
dup first pick second glVertex2d
|
||||||
|
dup first2 glVertex2d
|
||||||
|
swap first swap second glVertex2d
|
||||||
|
] do-state ;
|
||||||
|
|
||||||
demo-gadget H{
|
demo-gadget H{
|
||||||
{ T{ key-down f f "LEFT" } [ KEY-ROTATE-STEP neg swap yaw-demo-gadget ] }
|
{ T{ key-down f f "LEFT" } [ KEY-ROTATE-STEP neg swap yaw-demo-gadget ] }
|
||||||
{ T{ key-down f f "RIGHT" } [ KEY-ROTATE-STEP swap yaw-demo-gadget ] }
|
{ T{ key-down f f "RIGHT" } [ KEY-ROTATE-STEP swap yaw-demo-gadget ] }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008 Matthew Willis.
|
! Copyright (C) 2008 Matthew Willis.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: locals math.functions math namespaces
|
USING: locals math.functions math namespaces
|
||||||
opengl.gl accessors kernel opengl ui.gadgets
|
opengl.gl opengl.demo-support accessors kernel opengl ui.gadgets
|
||||||
fry assocs
|
fry assocs
|
||||||
destructors sequences ui.render colors ;
|
destructors sequences ui.render colors ;
|
||||||
IN: opengl.gadgets
|
IN: opengl.gadgets
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
USING: kernel namespaces arrays sequences grouping
|
USING: kernel namespaces arrays sequences grouping
|
||||||
alien.c-types
|
alien.c-types
|
||||||
math math.vectors math.geometry.rect
|
math math.vectors math.geometry.rect
|
||||||
opengl.gl opengl.glu opengl generalizations vars
|
opengl.gl opengl.glu opengl.demo-support opengl generalizations vars
|
||||||
combinators.cleave colors ;
|
combinators.cleave colors ;
|
||||||
|
|
||||||
IN: processing.shapes
|
IN: processing.shapes
|
||||||
|
@ -19,13 +19,13 @@ T{ rgba f 1 1 1 1 } fill-color set-global
|
||||||
|
|
||||||
: fill-mode ( -- )
|
: fill-mode ( -- )
|
||||||
GL_FRONT_AND_BACK GL_FILL glPolygonMode
|
GL_FRONT_AND_BACK GL_FILL glPolygonMode
|
||||||
fill-color> set-color ;
|
fill-color> gl-color ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: stroke-mode ( -- )
|
: stroke-mode ( -- )
|
||||||
GL_FRONT_AND_BACK GL_LINE glPolygonMode
|
GL_FRONT_AND_BACK GL_LINE glPolygonMode
|
||||||
stroke-color> set-color ;
|
stroke-color> gl-color ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
@ -105,8 +105,8 @@ T{ rgba f 1 1 1 1 } fill-color set-global
|
||||||
|
|
||||||
: ellipse ( center dim -- )
|
: ellipse ( center dim -- )
|
||||||
GL_FRONT_AND_BACK GL_FILL glPolygonMode
|
GL_FRONT_AND_BACK GL_FILL glPolygonMode
|
||||||
[ stroke-color> set-color gl-ellipse ]
|
[ stroke-color> gl-color gl-ellipse ]
|
||||||
[ fill-color> set-color gl-get-line-width 2 * dup 2array v- gl-ellipse ] 2bi ;
|
[ fill-color> gl-color gl-get-line-width 2 * dup 2array v- gl-ellipse ] 2bi ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
USING: kernel opengl.demo-support opengl.gl opengl.shaders opengl.framebuffers
|
USING: kernel opengl opengl.demo-support opengl.gl
|
||||||
opengl multiline ui.gadgets accessors sequences ui.render ui math locals
|
opengl.shaders opengl.framebuffers opengl.capabilities multiline
|
||||||
arrays generalizations combinators opengl.capabilities ui.gadgets.worlds ;
|
ui.gadgets accessors sequences ui.render ui math locals arrays
|
||||||
|
generalizations combinators ui.gadgets.worlds ;
|
||||||
IN: spheres
|
IN: spheres
|
||||||
|
|
||||||
STRING: plane-vertex-shader
|
STRING: plane-vertex-shader
|
||||||
|
|
|
@ -25,7 +25,7 @@ IN: springies.ui
|
||||||
|
|
||||||
! : display ( -- ) set-projection black gl-color draw-nodes draw-springs ;
|
! : display ( -- ) set-projection black gl-color draw-nodes draw-springs ;
|
||||||
|
|
||||||
: display ( -- ) set-projection black set-color draw-nodes draw-springs ;
|
: display ( -- ) set-projection black gl-color draw-nodes draw-springs ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
|
|
@ -6,22 +6,22 @@ IN: tetris.gl
|
||||||
#! OpenGL rendering for tetris
|
#! OpenGL rendering for tetris
|
||||||
|
|
||||||
: draw-block ( block -- )
|
: draw-block ( block -- )
|
||||||
dup { 1 1 } v+ gl-fill-rect ;
|
[ { 1 1 } gl-fill-rect ] with-translation ;
|
||||||
|
|
||||||
: draw-piece-blocks ( piece -- )
|
: draw-piece-blocks ( piece -- )
|
||||||
piece-blocks [ draw-block ] each ;
|
piece-blocks [ draw-block ] each ;
|
||||||
|
|
||||||
: draw-piece ( piece -- )
|
: draw-piece ( piece -- )
|
||||||
dup tetromino>> colour>> set-color draw-piece-blocks ;
|
dup tetromino>> colour>> gl-color draw-piece-blocks ;
|
||||||
|
|
||||||
: draw-next-piece ( piece -- )
|
: draw-next-piece ( piece -- )
|
||||||
dup tetromino>> colour>>
|
dup tetromino>> colour>>
|
||||||
clone 0.2 >>alpha set-color draw-piece-blocks ;
|
clone 0.2 >>alpha gl-color draw-piece-blocks ;
|
||||||
|
|
||||||
! TODO: move implementation specific stuff into tetris-board
|
! TODO: move implementation specific stuff into tetris-board
|
||||||
: (draw-row) ( x y row -- )
|
: (draw-row) ( x y row -- )
|
||||||
>r over r> nth dup
|
>r over r> nth dup
|
||||||
[ set-color 2array draw-block ] [ 3drop ] if ;
|
[ gl-color 2array draw-block ] [ 3drop ] if ;
|
||||||
|
|
||||||
: draw-row ( y row -- )
|
: draw-row ( y row -- )
|
||||||
dup length -rot [ (draw-row) ] 2curry each ;
|
dup length -rot [ (draw-row) ] 2curry each ;
|
||||||
|
|
Loading…
Reference in New Issue