! Copyright (C) 2010 Anton Gorenko.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.strings gdk.gl.ffi gobject.ffi gtk.ffi gtk.gl.ffi
-io.encodings.utf8 kernel locals opengl.gl ;
+io.encodings.utf8 kernel locals opengl.demo-support opengl.gl ;
IN: gtk-samples.opengl
! This sample is based on
[
GL_COLOR_BUFFER_BIT glClear
- GL_TRIANGLES glBegin
- 1.0 0.0 0.0 glColor3f
- 0 1 glVertex2i
- 0.0 1.0 0.0 glColor3f
- -1 -1 glVertex2i
- 0.0 0.0 1.0 glColor3f
- 1 -1 glVertex2i
- glEnd
+ GL_TRIANGLES [
+ 1.0 0.0 0.0 glColor3f
+ 0 1 glVertex2i
+ 0.0 1.0 0.0 glColor3f
+ -1 -1 glVertex2i
+ 0.0 0.0 1.0 glColor3f
+ 1 -1 glVertex2i
+ ] do-state
gl-drawable gdk_gl_drawable_is_double_buffered 1 =
[ gl-drawable gdk_gl_drawable_swap_buffers ]
! Copyright (C) 2010 Erik Charlebois.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel locals math math.order math.polynomials
-math.splines opengl.gl sequences ui.gadgets ui.gadgets.panes ui.render
-arrays ;
+math.splines opengl.demo-support opengl.gl sequences ui.gadgets
+ui.gadgets.panes ui.render arrays ;
IN: math.splines.viewer
<PRIVATE
[ second y-min - y-max y-min - / gadget spline-dim>> second * ] bi 2array
] map :> pts
- GL_LINE_STRIP glBegin
- pts [
- first2 neg gadget spline-dim>> second + glVertex2f
- ] each
- glEnd ;
+ GL_LINE_STRIP [
+ pts [
+ first2 neg gadget spline-dim>> second + glVertex2f
+ ] each ]
+ do-state ;
:: <spline-gadget> ( polynomials dim steps -- gadget )
spline-gadget new
! From http://www.ffconsultancy.com/ocaml/maze/index.html
USING: accessors arrays fry kernel math math.order math.vectors
-namespaces opengl.gl random sequences ui ui.gadgets
-ui.gadgets.canvas ui.render ;
+namespaces opengl.demo-support opengl.gl random sequences ui
+ui.gadgets ui.gadgets.canvas ui.render ;
IN: maze
CONSTANT: line-width 8
: (draw-maze) ( cell -- )
dup vertex
glEnd
- GL_POINTS glBegin dup vertex glEnd
+ GL_POINTS [ dup vertex ] do-state
GL_LINE_STRIP glBegin
dup vertex
dup visit
line-width 2 - glPointSize
1.0 1.0 1.0 1.0 glColor4d
dup '[ _ t <array> ] replicate visited set
- GL_LINE_STRIP glBegin
- { 0 0 } dup vertex (draw-maze)
- glEnd ;
+ GL_LINE_STRIP [
+ { 0 0 } dup vertex (draw-maze)
+ ] do-state ;
TUPLE: maze < canvas ;
USING: alien.c-types alien.data arrays colors.constants grouping
-kernel locals math math.vectors namespaces opengl opengl.gl
-opengl.glu sequences sequences.generalizations shuffle ;
+kernel locals math math.vectors namespaces opengl opengl.demo-support
+opengl.gl opengl.glu sequences sequences.generalizations shuffle ;
IN: processing.shapes
-: do-state ( mode quot -- ) swap glBegin call glEnd ; inline
-
SYMBOL: fill-color
SYMBOL: stroke-color