anchor.diff:          (gl:enable :texture-2d)
           (gl-ortho-setup :width width :height height)
   
  -        (autowrap:with-alloc (tex :unsigned-char (* *texture-size* *texture-size* 4))
  +        (autowrap:with-alloc (tex :unsigned-char
  +                                  (* *texture-size* *texture-size* 4))
             (let* ((program (gl-init-shaders))
  +                 (texname (car (gl:gen-textures 1)))
                    (texid (gl:get-uniform-location program "tex")))
  -            (%gl:active-texture :texture0)
  +
  +            (gl:active-texture :texture0)
  +            (gl:bind-texture :texture-2d texname)
               (gl:uniformi texid 0)
   
               (gl:tex-parameter :texture-2d :texture-wrap-s :repeat)
  
positive.code:             (gl:use-program program)))
        program)))
  
  (defun render (window width height margin tex)
    (let* ((surf (cairo:create-image-surface-for-data
                  tex :argb32
                  *texture-size* *texture-size* (* 4 *texture-size*)))
           (ctx (cairo:create-context surf)))
      (progn
        (cairo:with-context (ctx)
          (cairo:set-source-rgb 1 1 1)
          (cairo:paint)
          (cairo:set-source-rgb 0 0 1)
          (cairo:set-line-width 3)
          (cairo:move-to 0 0)
          (cairo:line-to *texture-size* *texture-size*)
          (cairo:stroke)
  
          (cairo:set-source-rgb 1 0 0)
          (cairo:set-line-width 1)
          (cairo:arc 0 0 30 0 (* 2 pi))
          (cairo:stroke)
          (cairo:arc *texture-size* *texture-size* 30 0 (* 2 pi))
          (cairo:stroke))
        (cairo:destroy ctx)
        (cairo:destroy surf)))
    (gl:tex-image-2d :texture-2d 0 :rgba
                     *texture-size* *texture-size*
                     0 :rgba :unsigned-byte tex)
    (gl:begin :quads)
    (gl:color 1.0 0.0 0.0 1.0)
    (%gl:tex-coord-2f 0.0 0.0)
    (gl:vertex margin margin)
    (%gl:tex-coord-2f 0.0 1.0)
    (gl:vertex margin (- height margin))
    (%gl:tex-coord-2f 1.0 1.0)
    (gl:vertex (- width margin) (- height margin))
    (%gl:tex-coord-2f 1.0 0.0)
    (gl:vertex (- width margin) margin)
    (gl:end)
    (gl:flush)
    (sdl2:gl-swap-window window))
  
  (defun cairo-test (&key (width *texture-size*) (height *texture-size*) (margin 0))
    (sdl2:with-init (:everything)
      (multiple-value-bind (window renderer)
          (sdl2:create-window-and-renderer width height '(:shown :opengl))
  
negative.code:   (asdf:load-system :cl-cairo2))
  
  (defparameter *vertex-shader* "
  varying vec2 texture_coordinate;
  void main() {
      texture_coordinate = vec2(gl_MultiTexCoord0);
      gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
  }
  ")
  
  (defparameter *fragment-shader* "
  #version 120
  
  varying vec2 texture_coordinate;
  uniform sampler2D tex;
  
  void main() {
      gl_FragColor = texture2D(tex, texture_coordinate);
  }
  ")
  
  