Skip to content

glCore registerhook

Chris Petersen edited this page Oct 16, 2014 · 1 revision

glCore-registerhook registers a custom OpenGL hook to be rendered. This is used to plot 3D objects.

Parameter Description
h Hook function

Example

From DemoCube the custom rendering function:

(define (render-custom)
  (glClearColor 0. 0. 0. 0.)
  (glClear (bitwise-ior GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT))
  (glMatrixMode GL_PROJECTION)
  (glLoadIdentity)
  (glFrustum -1.0 1.0 -1.0 1.0 1.5 20.0)
  (glMatrixMode GL_MODELVIEW)
  (glLoadIdentity)
  (glEnable GL_CULL_FACE)
  (glCullFace GL_BACK)
  (glEnable GL_DEPTH_TEST)
  (glDepthMask GL_TRUE)
  (glTranslatef 0 0 -5)
  (glRotatef 30 1 0 0)
  (glRotatef alpha 0 1 0)
  (let loop ((vs cube_vertices)(cs cube_colors))
    (if (> (length vs) 0) (begin
      (glCoreColor (car cs))
      (glCoreBegin GL_TRIANGLE_STRIP)
      (map (lambda (l) (apply glCoreVertex3f l)) (car vs))
      (glCoreEnd)
      (loop (cdr vs) (cdr cs)))))
  (set! alpha (+ alpha alphaincrement)))
Clone this wiki locally