#lang racket/gui
(require (planet "rgl.rkt" ("stephanh" "RacketGL.plt" 1 3)))
(require ffi/vector)
(require "viewer.rkt")
(define (print-info)
(for ((ext (in-set (gl-extensions))))
(printf "Extension: ~a~%" ext))
(printf "~s~%" (gl-version))
(if (gl-has-extension? 'GL_EXT_texture_object)
(printf "Yep, we have GL_EXT_texture_object~%")
(printf "Sorry no GL_EXT_texture_object~%"))
(let ((v (glGetIntegerv GL_VERTEX_ARRAY)))
(printf "glGet on GL_VERTEX_ARRAY = ~s~%" (s32vector-ref v 0))))
(define (draw)
(define vertex-array
(f64vector -0.5 -0.5
0.5 -0.5
0.5 0.5
-0.5 0.5))
(let-values (((type cptr) (gl-vector->type/cpointer vertex-array)))
(glVertexPointer 2 type 0 cptr))
(glEnableClientState GL_VERTEX_ARRAY)
(glDrawArrays GL_QUADS 0 4)
(glDisableClientState GL_VERTEX_ARRAY))
(view draw print-info)