This commit is contained in:
Ingy döt Net 2013-06-05 21:47:54 +00:00
parent 1f1ad49427
commit 6f050a029e
2496 changed files with 37609 additions and 3031 deletions

View file

@ -27,7 +27,7 @@
ON CLOSE PROCcleanup : QUIT
ON ERROR PROCcleanup : SYS "MessageBox", @hwnd%, REPORT$, 0, 48 : QUIT
DIM GLcolor{r, g, b}, GLvertex{x, y}
DIM GLcolor{r#, g#, b#}, GLvertex{x#, y#}
DIM pfd{nSize{l&,h&}, nVersion{l&,h&}, dwFlags%, iPixelType&, cColorBits&, \
\ cRedBits&, cRedShift&, cGreenBits&, cGreenShift&, cBlueBits&, cBlueShift&, \
\ cAlphaBits&, cAlphaShift&, cAccumBits&, cAccumRedBits&, cAccumGreenBits&, \
@ -58,17 +58,17 @@
WAIT 2
SYS `glClear`, GL_COLOR_BUFFER_BIT OR GL_DEPTH_BUFFER_BIT
SYS `glBegin`, GL_TRIANGLES
GLcolor.r = 1.0 : GLcolor.g = 0.0 : GLcolor.b = 0.0
GLcolor.r# = 1.0 : GLcolor.g# = 0.0 : GLcolor.b# = 0.0
SYS `glColor3dv`, GLcolor{}
GLvertex.x = 0.0 : GLvertex.y = 0.8
GLvertex.x# = 0.0 : GLvertex.y# = 0.8
SYS `glVertex2dv`, GLvertex{}
GLcolor.r = 0.0 : GLcolor.g = 1.0 : GLcolor.b = 0.0
GLcolor.r# = 0.0 : GLcolor.g# = 1.0 : GLcolor.b# = 0.0
SYS `glColor3dv`, GLcolor{}
GLvertex.x = 0.8 : GLvertex.y = -0.8
GLvertex.x# = 0.8 : GLvertex.y# = -0.8
SYS `glVertex2dv`, GLvertex{}
GLcolor.r = 0.0 : GLcolor.g = 0.0 : GLcolor.b = 1.0
GLcolor.r# = 0.0 : GLcolor.g# = 0.0 : GLcolor.b# = 1.0
SYS `glColor3dv`, GLcolor{}
GLvertex.x = -0.8 : GLvertex.y = -0.8
GLvertex.x# = -0.8 : GLvertex.y# = -0.8
SYS `glVertex2dv`, GLvertex{}
SYS `glEnd`
SYS "SwapBuffers", ghDC%

View file

@ -1,4 +1,4 @@
#lang racket/gui
#lang racket/gui
(require sgl/gl)
(define (resize w h)
@ -29,21 +29,14 @@
(define my-canvas%
(class* canvas% ()
(inherit with-gl-context swap-gl-buffers)
(define/override (on-paint)
(with-gl-context
(lambda ()
(draw-opengl)
(swap-gl-buffers))))
(define/override (on-paint)
(with-gl-context (λ() (draw-opengl) (swap-gl-buffers))))
(define/override (on-size width height)
(with-gl-context
(lambda ()
(resize width height))))
(with-gl-context (λ() (resize width height))))
(super-instantiate () (style '(gl)))))
(define win (new frame% (label "Racket Rosetta Code OpenGL example") (min-width 200) (min-height 200)))
(define gl (new my-canvas% (parent win)))
(define win (new frame% [label "Racket Rosetta Code OpenGL example"]
[min-width 200] [min-height 200]))
(define gl (new my-canvas% [parent win]))
(send win show #t)