3d大爆炸不工作

时间:2017-02-13 03:38:17

标签: scheme racket

我正在尝试关注来自https://docs.racket-lang.org/pict3d/universe.html的简单代码:

#lang racket
(require pict3d
         pict3d/universe)
(big-bang3d 0)

然而,在运行它时,DrRacket崩溃并关闭。从Linux中的脚本文件运行时,它会生成一个黑色窗口,该窗口会粘住并且必须被杀死。控制台显示以下错误:

$ ./simple_bigbang.rkt
XSetErrorHandler: given value does not fit primitive C type
  C type: _fpointer
  given value: #<procedure:flag-x-error-handler>
  context...:
   /usr/share/racket/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt:292:5
   /usr/share/racket/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt:276:0: glx-create-context-attribs
   /usr/share/racket/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt:319:4: for-loop
   /usr/share/racket/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt:318:2

我在Linux Mint下运行DrRacket 6.3版。

问题出在哪里?如何纠正?

编辑:

我从http://download.racket-lang.org/安装了最新版本6.8并再次尝试。一个空窗口opnes但以下是错误:

.racket/6.8/pkgs/pict3d/pict3d/private/gl/framebuffer.rkt:89:0: check-gl-framebuffer-status: The framebuffer does not have at least one image attached to it.

我尝试了https://docs.racket-lang.org/pict3d/universe.html更复杂的版本:

#lang racket

(require pict3d
         pict3d/universe)

(current-material (material #:ambient 0.01
                            #:diffuse 0.39
                            #:specular 0.6
                            #:roughness 0.2))

(define lights+camera
  (combine (light (pos 0 1 2) (emitted "Thistle"))
           (light (pos 0 -1 -2) (emitted "PowderBlue"))
           (basis 'camera (point-at (pos 1 1 0) origin))))

(define (on-draw s n t)
  (combine (rotate-z (rotate-y (rotate-x (cube origin 1/2)
                                         (/ t 11))
                               (/ t 13))
                     (/ t 17))
           lights+camera))

(big-bang3d 0 #:on-draw on-draw)

同样,会打开一个空窗口,并显示以下错误:

.racket/6.8/pkgs/pict3d/pict3d/private/gl/framebuffer.rkt:89:0: check-gl-framebuffer-status: The framebuffer does not have at least one image attached to it.

1 个答案:

答案 0 :(得分:2)

  

我在Linux Mint下运行DrRacket版本6.3。

首先要做的事情。安装新版本的Racket以确保错误尚未修复。

如果可能的话,请使用以下版本:

http://download.racket-lang.org/