Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

don't let changes to blend-func escape write-to-screen

  • Loading branch information...
commit 85da1454bb97271587f92d12a490d200a8188687 1 parent 6343d6a
@ztellman authored
Showing with 32 additions and 25 deletions.
  1. +11 −8 src/penumbra/text.clj
  2. +21 −17 test/examples.clj
View
19 src/penumbra/text.clj
@@ -8,7 +8,7 @@
(ns penumbra.text
(:use [penumbra.opengl]
- [penumbra.opengl.core :only [*view* *font-cache* *font*]]
+ [penumbra.opengl.core :only [get-integer *view* *font-cache* *font*]]
[clojure.contrib.def :only (defvar defn-memo)])
(:import [java.awt Font]
[java.awt.font TextAttribute]
@@ -42,13 +42,16 @@
(try-with-program nil
(with-disabled [:texture-rectangle :lighting]
(with-enabled [:texture-2d :blend]
- (blend-func :src-alpha :one-minus-src-alpha)
- (let [[x-origin y-origin w h] @*view*]
- (with-projection (ortho-view x-origin (+ x-origin w) (+ y-origin h) y-origin -1 1)
- (push-matrix
- (load-identity)
- (TextureImpl/bindNone)
- (.drawString *font* x y string)))))))))
+ (let [blend-dst (get-integer :blend-dst)
+ blend-src (get-integer :blend-src)]
+ (blend-func :src-alpha :one-minus-src-alpha)
+ (let [[x-origin y-origin w h] @*view*]
+ (with-projection (ortho-view x-origin (+ x-origin w) (+ y-origin h) y-origin -1 1)
+ (push-matrix
+ (load-identity)
+ (TextureImpl/bindNone)
+ (.drawString *font* x y string))))
+ (blend-func blend-src blend-dst)))))))
View
38 test/examples.clj
@@ -8,22 +8,24 @@
(ns examples
(:use [clojure.test])
- (:require [example.app.async :as async]
- [example.app.switch :as switch]
- [example.app.nested :as nested]
- [example.opengl.gears :as gears]
- [example.opengl.sierpinski :as sierpinski]
- [example.opengl.render-to-texture :as rtt]
- [example.opengl.marble :as marble]
- [example.opengl.accumulate :as accumulate]
- [example.opengl.async :as gl-async]
- [example.game.tetris :as tetris]
- [example.game.asteroids :as asteroids]
- [example.game.pong :as pong]
- [example.gpgpu.mandelbrot :as mandelbrot]
- [example.gpgpu.convolution :as convolution]
- [example.gpgpu.brians-brain :as brian]
- [example.gpgpu.fluid :as fluid]))
+ (:require
+ ;;[example.app.async :as async]
+ ;;[example.app.switch :as switch]
+ ;;[example.app.nested :as nested]
+ [example.opengl.text :as text]
+ [example.opengl.gears :as gears]
+ [example.opengl.sierpinski :as sierpinski]
+ [example.opengl.render-to-texture :as rtt]
+ [example.opengl.marble :as marble]
+ [example.opengl.accumulate :as accumulate]
+ [example.opengl.async :as gl-async]
+ [example.game.tetris :as tetris]
+ [example.game.asteroids :as asteroids]
+ [example.game.pong :as pong]
+ [example.gpgpu.mandelbrot :as mandelbrot]
+ [example.gpgpu.convolution :as convolution]
+ [example.gpgpu.brians-brain :as brian]
+ [example.gpgpu.fluid :as fluid]))
(deftest run
'(testing "Async"
@@ -31,7 +33,9 @@
'(testing "Switch"
(switch/start))
'(testing "Nested"
- (nested/start))
+ (nested/start))
+ '(testing "Text"
+ (text/start))
(testing "Gears"
(gears/start))
(testing "Sierpinski"
Please sign in to comment.
Something went wrong with that request. Please try again.