ztellman / penumbra

not under active development - idiomatic opengl bindings for clojure
354 stars 43 forks source link

Very weird error when writing text to screen #23

Closed tgk closed 12 years ago

tgk commented 14 years ago

I've successfully used penumbra for a visualization project drawing normal vertices and more complex figures. One thing that simply won't work, however, is writing text to the screen. Even this very simple example fail.

My output is

 [null] java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer
 [null]     at clojure.lang.LazySeq.sval(LazySeq.java:47)
 [null]     at clojure.lang.LazySeq.seq(LazySeq.java:56)
 [null]     at clojure.lang.RT.seq(RT.java:440)
 [null]     at clojure.core$seq__4245.invoke(core.clj:105)
 [null]     at penumbra.app.event$publish_BANG___4605.doInvoke(event.clj:30)
 [null]     at clojure.lang.RestFn.invoke(RestFn.java:430)
 [null]     at clojure.lang.AFn.applyToHelper(AFn.java:175)
 [null]     at clojure.lang.RestFn.applyTo(RestFn.java:137)
 [null]     at clojure.core$apply__4370.invoke(core.clj:436)
 [null]     at penumbra.app$publish_BANG___5136.doInvoke(app.clj:69)
 [null]     at clojure.lang.RestFn.invoke(RestFn.java:415)
 [null]     at penumbra.app$single_thread_main_loop__5300$fn__5303.invoke(app.clj:326)
 [null]     at penumbra.app$single_thread_main_loop__5300.invoke(app.clj:324)
 [null]     at penumbra.app$single_thread_main_loop__5300.invoke(app.clj:313)
 [null]     at penumbra.app.loop$primary_loop__4991$fn__5013.invoke(loop.clj:87)
 [null]     at penumbra.app$start_single_thread__5314$fn__5316$fn__5318.invoke(app.clj:339)
 [null]     at penumbra.app$start_single_thread__5314$fn__5316.invoke(app.clj:337)
 [null]     at penumbra.app.loop$primary_loop__4991.invoke(loop.clj:84)
 [null]     at penumbra.app$start_single_thread__5314.invoke(app.clj:334)
 [null]     at penumbra.app$start__5327.invoke(app.clj:376)
 [null]     at penumbra.app$start__5327.invoke(app.clj:373)
 [null] <<STOPPED: Penumbra
 [null]     at penumbra_fail$view_text__5360.doInvoke(penumbra_fail.clj:10)
 [null]   0.50 seconds elapsed
 [null]   Allocated texture memory: 0.00M (0.00% in use)>>
 [null]     at clojure.lang.RestFn.invoke(RestFn.java:402)
 [null]     at user$eval__1.invoke(NO_SOURCE_FILE:1)
 [null]     at clojure.lang.Compiler.eval(Compiler.java:4642)
 [null]     at clojure.lang.Compiler.eval(Compiler.java:4634)
 [null]     at clojure.core$eval__5236.invoke(core.clj:2017)
 [null]     at clojure.main$eval_opt__7411.invoke(main.clj:227)
 [null]     at clojure.main$initialize__7418.invoke(main.clj:246)
 [null]     at clojure.main$null_opt__7446.invoke(main.clj:271)
 [null]     at clojure.main$main__7466.doInvoke(main.clj:346)
 [null]     at clojure.lang.RestFn.invoke(RestFn.java:426)
 [null]     at clojure.lang.Var.invoke(Var.java:363)
 [null]     at clojure.lang.AFn.applyToHelper(AFn.java:175)
 [null]     at clojure.lang.Var.applyTo(Var.java:476)
 [null]     at clojure.main.main(main.java:37)
 [null] Caused by: java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer
 [null]     at clojure.lang.LazySeq.sval(LazySeq.java:47)
 [null]     at clojure.lang.LazySeq.seq(LazySeq.java:56)
 [null]     at clojure.lang.RT.seq(RT.java:440)
 [null]     at clojure.core$seq__4245.invoke(core.clj:105)
 [null]     at clojure.core$filter__5084$fn__5086.invoke(core.clj:1794)
 [null]     at clojure.lang.LazySeq.sval(LazySeq.java:42)
 [null]     ... 35 more
 [null] Caused by: java.lang.ClassCastException: java.lang.Integer
 [null]     at java.awt.Font.initFromMap(Font.java:520)
 [null]     at java.awt.Font.<init>(Font.java:489)
 [null]     at penumbra.text$font__4328.doInvoke(text.clj:34)
 [null]     at clojure.lang.RestFn.invoke(RestFn.java:443)
 [null]     at penumbra.text$write_to_screen__4344.invoke(text.clj:46)
 [null]     at penumbra_fail$display__5356.invoke(penumbra_fail.clj:7)
 [null]     at clojure.lang.AFn.applyToHelper(AFn.java:175)
 [null]     at clojure.lang.AFn.applyTo(AFn.java:164)
 [null]     at clojure.core$apply__4370.invoke(core.clj:436)
 [null]     at penumbra.app.loop$timed_fn__4879$fn__4881.doInvoke(loop.clj:39)
 [null]     at clojure.lang.RestFn.invoke(RestFn.java:413)
 [null]     at penumbra.app$create__5146$fn__5157.invoke(app.clj:106)
 [null]     at clojure.lang.AFn.applyToHelper(AFn.java:171)
 [null]     at clojure.lang.AFn.applyTo(AFn.java:164)
 [null]     at clojure.core$apply__4370.invoke(core.clj:436)
 [null]     at penumbra.app.event$publish_BANG___4605$wrapper_fn__4607$fn__4609.doInvoke(event.clj:28)
 [null]     at clojure.lang.RestFn.invoke(RestFn.java:402)
 [null]     at clojure.lang.AFn.applyToHelper(AFn.java:171)
 [null]     at clojure.lang.RestFn.applyTo(RestFn.java:137)
 [null]     at clojure.core$apply__4370.invoke(core.clj:436)
 [null]     at penumbra.app.event$publish_BANG___4605$fn__4617.invoke(event.clj:30)
 [null]     at clojure.core$map__5053$fn__5055.invoke(core.clj:1762)
 [null]     at clojure.lang.LazySeq.sval(LazySeq.java:42)
 [null]     ... 40 more

I'm running the program on Mac OS X version 10.5.8, and I do have the Tahoma type installed. I'm using Clojure 1.1.0 and the appropriate libraries. This is my project.clj file.

tgk commented 14 years ago

Apparently, switching to java version 1.6 solves this problem.

ztellman commented 14 years ago

Yeah, apparently there are differences in how fonts are handled between 1.5 and 1.6. I'm going to leave this open until I document somewhere that 1.6 the targeted JVM version.